Handle emboldened text with quotes

main
Bob Mottram 2022-03-24 13:45:55 +00:00
parent d0f6ddd296
commit a1f2096900
1 changed files with 12 additions and 2 deletions

View File

@ -1342,10 +1342,20 @@ def bold_reading_string(text: str) -> str:
if len(wrd) > 1 and \ if len(wrd) > 1 and \
'<' not in wrd and '>' not in wrd and \ '<' not in wrd and '>' not in wrd and \
not wrd.startswith(':'): not wrd.startswith(':'):
prefix = ''
postfix = ''
if wrd.startswith('"'):
prefix = '"'
wrd = wrd[1:]
if wrd.endswith('"'):
postfix = '"'
wrd = wrd[:len(wrd) - 1]
initial_chars = int(len(wrd) / 2) initial_chars = int(len(wrd) / 2)
new_parag += \ new_parag += \
'<b>' + wrd[:initial_chars] + '</b>' + \ prefix + '<b>' + wrd[:initial_chars] + '</b>' + \
wrd[initial_chars:] + ' ' wrd[initial_chars:] + postfix + ' '
else: else:
new_parag += wrd + ' ' new_parag += wrd + ' '
parag_ctr += 1 parag_ctr += 1