From 2c087d5e2aed61300bc04ed2627355ba9a05a0ee Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 24 Mar 2022 15:57:44 +0000 Subject: [PATCH] Another unit test for markup with bold reading --- content.py | 5 ++++- tests.py | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/content.py b/content.py index 0bf1f9273..387ec7b59 100644 --- a/content.py +++ b/content.py @@ -1351,7 +1351,8 @@ def bold_reading_string(text: str) -> str: reading_markup = False if not reading_markup and len(wrd) > 1 and \ '<' not in wrd and '>' not in wrd and \ - '&' not in wrd and not wrd.startswith(':'): + '&' not in wrd and '=' not in wrd and \ + not wrd.startswith(':'): prefix = '' postfix = '' @@ -1370,6 +1371,8 @@ def bold_reading_string(text: str) -> str: new_parag += wrd + ' ' parag_ctr += 1 new_parag = new_parag.strip() + if not new_parag: + continue if parag_ctr < len(paragraphs): if not add_paragraph_markup: new_text += new_parag + '\n' diff --git a/tests.py b/tests.py index 98d4e4d4a..5bdbb364e 100644 --- a/tests.py +++ b/tests.py @@ -6739,6 +6739,20 @@ def _test_bold_reading() -> None: print(text_bold) assert text_bold == expected + text = '

@Someone or other' + \ + ' some text

' + text_bold = bold_reading_string(text) + expected = \ + '

' + \ + '@Someone or other' + \ + ' some text

' + if text_bold != expected: + print(text_bold) + assert text_bold == expected + def run_all_tests(): base_dir = os.getcwd()