Merge branch 'format-sup+nbsp-smaller-in-bibles' into 'master'

Smaller bible chapter and verse numbers

See merge request openlp/openlp!413
This commit is contained in:
Tim Bentley 2022-02-10 12:10:13 +00:00
commit 65a9818134
4 changed files with 22 additions and 5 deletions

View File

@ -28,7 +28,8 @@ body.hide-mouse {
sup {
vertical-align: super !important;
font-size: smaller !important;
font-size: 50% !important;
line-height: 0 !important;
}
body,

View File

@ -152,6 +152,10 @@ def remove_tags(text, can_remove_chords=False):
text = text.replace('<br>', '\n')
text = text.replace('{br}', '\n')
text = text.replace('&nbsp;', ' ')
text = text.replace('<sup>', '')
text = text.replace('</sup>', '')
text = text.replace('<em>', '')
text = text.replace('</em>', '')
for tag in FormattingTags.get_html_tags():
text = text.replace(tag['start tag'], '')
text = text.replace(tag['end tag'], '')

View File

@ -1024,7 +1024,7 @@ class BibleMediaItem(MediaManagerItem):
DisplayStyle.Curly: ('{', '}'),
DisplayStyle.Square: ('[', ']')
}[self.settings_tab.display_style]
return '{{su}}{bracket[0]}{verse_text}{bracket[1]}{{/su}}&nbsp;'.format(verse_text=verse_text, bracket=bracket)
return '{{su}}{bracket[0]}{verse_text}{bracket[1]}&nbsp;{{/su}}'.format(verse_text=verse_text, bracket=bracket)
def search_options(self, option=None):
"""

View File

@ -39,10 +39,22 @@ def test_remove_tags(mocked_get_tags):
'start tag': '{b}',
'start html': '<span style="-webkit-text-fill-color:black">',
'end tag': '{/b}', 'end html': '</span>', 'protected': True,
'temporary': False
'temporary': False, 'hidden': False
}, {
'desc': 'Italics',
'start tag': '{it}',
'start html': '<em>',
'end tag': '{/it}', 'end html': '</em>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'desc': 'Superscript',
'start tag': '{su}',
'start html': '<sup>',
'end tag': '{/su}', 'end html': '</sup>', 'protected': True,
'temporary': False, 'hidden': False
}]
string_to_pass = 'ASDF<br>foo{br}bar&nbsp;{b}black{/b}'
expected_string = 'ASDF\nfoo\nbar black'
string_to_pass = 'ASDF<br>foo{br}bar&nbsp;{b}black{/b} {su}1,1&nbsp;{/su}In the {it}beggining{/it}...'
expected_string = 'ASDF\nfoo\nbar black 1,1 In the beggining...'
# WHEN: Clean the string.
result_string = remove_tags(string_to_pass)