Fix the CI error after merging !414 and !417

This commit is contained in:
Raoul Snyman 2022-02-12 06:45:27 +00:00 committed by Tomas Groth
parent 4297124c02
commit c6a9926e02
2 changed files with 136 additions and 62 deletions

View File

@ -157,7 +157,7 @@ def remove_tags(text, can_remove_chords=False):
text = text.replace('<em>', '')
text = text.replace('</em>', '')
for tag in FormattingTags.get_html_tags():
if tag['hidden']:
if tag.get('hidden'):
text = re.sub(r'' + tag['start tag'] + ".*?" + tag['end tag'], '', text)
else:
text = text.replace(tag['start tag'], '')

View File

@ -63,99 +63,173 @@ class FormattingTags(object):
'desc': translate('OpenLP.FormattingTags', 'Red'),
'start tag': '{r}',
'start html': '<span style="-webkit-text-fill-color:red">',
'end tag': '{/r}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/r}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Black'),
'start tag': '{b}',
'start html': '<span style="-webkit-text-fill-color:black">',
'end tag': '{/b}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/b}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Blue'),
'start tag': '{bl}',
'start html': '<span style="-webkit-text-fill-color:blue">',
'end tag': '{/bl}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/bl}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Yellow'),
'start tag': '{y}',
'start html': '<span style="-webkit-text-fill-color:yellow">',
'end tag': '{/y}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/y}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Green'),
'start tag': '{g}',
'start html': '<span style="-webkit-text-fill-color:green">',
'end tag': '{/g}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/g}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Pink'),
'start tag': '{pk}',
'start html': '<span style="-webkit-text-fill-color:#FFC0CB">',
'end tag': '{/pk}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/pk}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Orange'),
'start tag': '{o}',
'start html': '<span style="-webkit-text-fill-color:#FFA500">',
'end tag': '{/o}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/o}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Purple'),
'start tag': '{pp}',
'start html': '<span style="-webkit-text-fill-color:#800080">',
'end tag': '{/pp}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/pp}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'White'),
'start tag': '{w}',
'start html': '<span style="-webkit-text-fill-color:white">',
'end tag': '{/w}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'desc': translate('OpenLP.FormattingTags', 'Superscript'),
'start tag': '{su}', 'start html': '<sup>',
'end tag': '{/su}', 'end html': '</sup>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'desc': translate('OpenLP.FormattingTags', 'Subscript'),
'start tag': '{sb}', 'start html': '<sub>',
'end tag': '{/sb}', 'end html': '</sub>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'desc': translate('OpenLP.FormattingTags', 'Paragraph'),
'start tag': '{p}', 'start html': '<p>', 'end tag': '{/p}',
'end html': '</p>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'desc': translate('OpenLP.FormattingTags', 'Bold'),
'start tag': '{st}', 'start html': '<strong>',
'end tag': '{/st}', 'end html': '</strong>',
'protected': True, 'temporary': False, 'hidden': False
}, {
'desc': translate('OpenLP.FormattingTags', 'Italics'),
'start tag': '{it}', 'start html': '<em>', 'end tag': '{/it}',
'end html': '</em>', 'protected': True, 'temporary': False,
'end tag': '{/w}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
}, {
},
{
'desc': translate('OpenLP.FormattingTags', 'Superscript'),
'start tag': '{su}',
'start html': '<sup>',
'end tag': '{/su}',
'end html': '</sup>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Subscript'),
'start tag': '{sb}',
'start html': '<sub>',
'end tag': '{/sb}',
'end html': '</sub>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Paragraph'),
'start tag': '{p}',
'start html': '<p>',
'end tag': '{/p}',
'end html': '</p>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Bold'),
'start tag': '{st}',
'start html': '<strong>',
'end tag': '{/st}',
'end html': '</strong>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Italics'),
'start tag': '{it}',
'start html': '<em>',
'end tag': '{/it}',
'end html': '</em>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Underline'),
'start tag': '{u}',
'start html': '<span style="text-decoration: underline;">',
'end tag': '{/u}', 'end html': '</span>', 'protected': True,
'temporary': False, 'hidden': False
}, {
'end tag': '{/u}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'UpperCase'),
'start tag': '{uc}',
'start html': '<span style="text-transform: uppercase;">',
'end tag': '{/uc}', 'end html': '</span>', 'protected': True,
'temporary': False
}, {
'end tag': '{/uc}',
'end html': '</span>',
'protected': True,
'temporary': False,
'hidden': False
},
{
'desc': translate('OpenLP.FormattingTags', 'Break'),
'start tag': '{br}', 'start html': '<br>', 'end tag': '',
'end html': '', 'protected': True,
'temporary': False, 'hidden': False
}]
'start tag': '{br}',
'start html': '<br>',
'end tag': '',
'end html': '',
'protected': True,
'temporary': False,
'hidden': False
}
]
# Append the base tags.
FormattingTags.add_html_tags(base_tags)
FormattingTags.add_html_tags(temporary_tags)