File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -432,7 +432,8 @@ def on_post_build(self, config: config_options.Config) -> None:
432432 prev_char = ""
433433 for char in template .render (feed = asdict (self .feed_created )):
434434 if char == "\n " :
435- continue
435+ # convert new lines to spaces to preserve sentence structure
436+ char = " "
436437 if char == " " and prev_char == " " :
437438 prev_char = char
438439 continue
@@ -442,8 +443,8 @@ def on_post_build(self, config: config_options.Config) -> None:
442443 with out_feed_updated .open (mode = "w" , encoding = "UTF8" ) as fifeed_updated :
443444 for char in template .render (feed = asdict (self .feed_updated )):
444445 if char == "\n " :
445- prev_char = char
446- continue
446+ # convert new lines to spaces to preserve sentence structure
447+ char = " "
447448 if char == " " and prev_char == " " :
448449 prev_char = char
449450 continue
Original file line number Diff line number Diff line change @@ -405,6 +405,12 @@ def test_simple_build_item_length_unlimited(self):
405405 150 ,
406406 f"Failed item title: { feed_item .title } " ,
407407 )
408+ # check sentences split across multiple lines retain spacing
409+ if feed_item .title in ["My first blog post" , "A second post" ]:
410+ self .assertIn (
411+ "Pellentesque nec maximus ex." ,
412+ feed_item .summary ,
413+ )
408414
409415 def test_simple_build_item_delimiter (self ):
410416 with tempfile .TemporaryDirectory () as tmpdirname :
You can’t perform that action at this time.
0 commit comments