Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions mkdocs_rss_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ def on_post_build(self, config: config_options.Config) -> None:
prev_char = ""
for char in template.render(feed=asdict(self.feed_created)):
if char == "\n":
continue
# convert new lines to spaces to preserve sentence structure
char = " "
if char == " " and prev_char == " ":
prev_char = char
continue
Expand All @@ -442,8 +443,8 @@ def on_post_build(self, config: config_options.Config) -> None:
with out_feed_updated.open(mode="w", encoding="UTF8") as fifeed_updated:
for char in template.render(feed=asdict(self.feed_updated)):
if char == "\n":
prev_char = char
continue
# convert new lines to spaces to preserve sentence structure
char = " "
if char == " " and prev_char == " ":
prev_char = char
continue
Expand Down
6 changes: 6 additions & 0 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,12 @@ def test_simple_build_item_length_unlimited(self):
150,
f"Failed item title: {feed_item.title}",
)
# check sentences split across multiple lines retain spacing
if feed_item.title in ["My first blog post", "A second post"]:
self.assertIn(
"Pellentesque nec maximus ex.",
feed_item.summary,
)

def test_simple_build_item_delimiter(self):
with tempfile.TemporaryDirectory() as tmpdirname:
Expand Down