Skip to content

Commit 2e9415b

Browse files
committed
Fix paragraph breaks in exported $page->text()
1 parent ff565ba commit 2e9415b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ c::set('paperback.exclude.template', []);
3131

3232
## Known Issues
3333

34-
+ Paragraphs in the exported text should be separated by double line breaks
35-
+ The exported content is not timestamped or versioned
34+
+ Exported content is not timestamped or versioned
35+
+ The breaks surrounding headings are collapsed so text block are mashed together
3636
+ Output is currently optimized for the [Newton Glossary](http://newtonglossary.com/) instance of [Kirby](https://getkirby.com/)
3737

3838
## Release Notes

snippets/page.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?php echo '@@TOC ' . $page->title() . PHP_EOL . PHP_EOL ?>
2-
<?php echo html_entity_decode(strip_tags($page->text()->kirbytext())) . PHP_EOL . PHP_EOL ?>
2+
<?php $buffer = str_replace(array("</p>\r<p>", "</p>\r <p>", "</p> \r<p>", "</p>\n<p>", "</p>\n <p>", "</p> \n<p>", "</p>\r\n<p>", "</p>\r\n <p>", "</p> \r\n<p>"), '</p>' . PHP_EOL . PHP_EOL . '<p>', $page->text()->kirbytext()); ?>
3+
<?php echo html_entity_decode(strip_tags($buffer)) . PHP_EOL . PHP_EOL ?>
34
<?php if($page->content()->has('Source')): ?>
45
<?php if($page->source()->pages()->count() > 1) { echo 'Sources: '; } else { echo 'Source: '; } ?>
5-
<? $n=0; foreach($page->source()->pages() as $source): $n++; ?>
6+
<?php $n=0; foreach($page->source()->pages() as $source): $n++; ?>
67
<?php echo $source->title() . PHP_EOL ?>
78
<?php endforeach ?>
89
<?php echo PHP_EOL ?>

0 commit comments

Comments
 (0)