mirror of https://gitlab.com/bashrc2/epicyon
Unescape before adding bold
parent
0f2b28ed1f
commit
bca1f1c5b7
|
@ -7,6 +7,7 @@ __email__ = "bob@libreserver.org"
|
|||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
|
||||
import html
|
||||
import os
|
||||
import email.parser
|
||||
import urllib.parse
|
||||
|
@ -1331,7 +1332,7 @@ def contains_invalid_local_links(content: str) -> bool:
|
|||
def bold_reading_string(text: str) -> str:
|
||||
"""Returns bold reading formatted text
|
||||
"""
|
||||
text = urllib.parse.unquote(text)
|
||||
text = html.unescape(text)
|
||||
add_paragraph_markup = False
|
||||
if '<p>' in text:
|
||||
text = text.replace('</p>', '\n').replace('<p>', '')
|
||||
|
|
8
tests.py
8
tests.py
|
@ -6731,6 +6731,14 @@ def _test_bold_reading() -> None:
|
|||
print(text_bold)
|
||||
assert text_bold == expected
|
||||
|
||||
text = "There's some quoted text here"
|
||||
text_bold = bold_reading_string(text)
|
||||
expected = \
|
||||
"<b>The</b>re's <b>so</b>me <b>quo</b>ted <b>te</b>xt <b>he</b>re"
|
||||
if text_bold != expected:
|
||||
print(text_bold)
|
||||
assert text_bold == expected
|
||||
|
||||
|
||||
def run_all_tests():
|
||||
base_dir = os.getcwd()
|
||||
|
|
Loading…
Reference in New Issue