Fixed conctenation of direct book pages within markdown export

- Updated to ensure seperation with newlines.
- Added test to cover.

For #3341
This commit is contained in:
Dan Brown
2022-03-23 14:31:42 +00:00
parent 981807220c
commit 1c859e94e0
2 changed files with 23 additions and 4 deletions

View File

@ -326,7 +326,7 @@ class ExportFormatter
$text .= $this->pageToMarkdown($page) . "\n\n";
}
return $text;
return trim($text);
}
/**
@ -338,12 +338,12 @@ class ExportFormatter
$text = '# ' . $book->name . "\n\n";
foreach ($bookTree as $bookChild) {
if ($bookChild instanceof Chapter) {
$text .= $this->chapterToMarkdown($bookChild);
$text .= $this->chapterToMarkdown($bookChild) . "\n\n";
} else {
$text .= $this->pageToMarkdown($bookChild);
$text .= $this->pageToMarkdown($bookChild) . "\n\n";
}
}
return $text;
return trim($text);
}
}