diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index f127bf84e..7c917c936 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -157,7 +157,7 @@ def remove_tags(text, can_remove_chords=False): text = text.replace('', '') text = text.replace('', '') 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'], '') diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 9ee8370e4..74795cfa5 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -63,99 +63,173 @@ class FormattingTags(object): 'desc': translate('OpenLP.FormattingTags', 'Red'), 'start tag': '{r}', 'start html': '', - 'end tag': '{/r}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/r}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Black'), 'start tag': '{b}', 'start html': '', - 'end tag': '{/b}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/b}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Blue'), 'start tag': '{bl}', 'start html': '', - 'end tag': '{/bl}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/bl}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Yellow'), 'start tag': '{y}', 'start html': '', - 'end tag': '{/y}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/y}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Green'), 'start tag': '{g}', 'start html': '', - 'end tag': '{/g}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/g}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Pink'), 'start tag': '{pk}', 'start html': '', - 'end tag': '{/pk}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/pk}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Orange'), 'start tag': '{o}', 'start html': '', - 'end tag': '{/o}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/o}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Purple'), 'start tag': '{pp}', 'start html': '', - 'end tag': '{/pp}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/pp}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'White'), 'start tag': '{w}', 'start html': '', - 'end tag': '{/w}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { - 'desc': translate('OpenLP.FormattingTags', 'Superscript'), - 'start tag': '{su}', 'start html': '', - 'end tag': '{/su}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { - 'desc': translate('OpenLP.FormattingTags', 'Subscript'), - 'start tag': '{sb}', 'start html': '', - 'end tag': '{/sb}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { - 'desc': translate('OpenLP.FormattingTags', 'Paragraph'), - 'start tag': '{p}', 'start html': '

', 'end tag': '{/p}', - 'end html': '

', 'protected': True, - 'temporary': False, 'hidden': False - }, { - 'desc': translate('OpenLP.FormattingTags', 'Bold'), - 'start tag': '{st}', 'start html': '', - 'end tag': '{/st}', 'end html': '', - 'protected': True, 'temporary': False, 'hidden': False - }, { - 'desc': translate('OpenLP.FormattingTags', 'Italics'), - 'start tag': '{it}', 'start html': '', 'end tag': '{/it}', - 'end html': '', 'protected': True, 'temporary': False, + 'end tag': '{/w}', + 'end html': '', + 'protected': True, + 'temporary': False, 'hidden': False - }, { + }, + { + 'desc': translate('OpenLP.FormattingTags', 'Superscript'), + 'start tag': '{su}', + 'start html': '', + 'end tag': '{/su}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { + 'desc': translate('OpenLP.FormattingTags', 'Subscript'), + 'start tag': '{sb}', + 'start html': '', + 'end tag': '{/sb}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { + 'desc': translate('OpenLP.FormattingTags', 'Paragraph'), + 'start tag': '{p}', + 'start html': '

', + 'end tag': '{/p}', + 'end html': '

', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { + 'desc': translate('OpenLP.FormattingTags', 'Bold'), + 'start tag': '{st}', + 'start html': '', + 'end tag': '{/st}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { + 'desc': translate('OpenLP.FormattingTags', 'Italics'), + 'start tag': '{it}', + 'start html': '', + 'end tag': '{/it}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Underline'), 'start tag': '{u}', 'start html': '', - 'end tag': '{/u}', 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }, { + 'end tag': '{/u}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'UpperCase'), 'start tag': '{uc}', 'start html': '', - 'end tag': '{/uc}', 'end html': '', 'protected': True, - 'temporary': False - }, { + 'end tag': '{/uc}', + 'end html': '', + 'protected': True, + 'temporary': False, + 'hidden': False + }, + { 'desc': translate('OpenLP.FormattingTags', 'Break'), - 'start tag': '{br}', 'start html': '
', 'end tag': '', - 'end html': '', 'protected': True, - 'temporary': False, 'hidden': False - }] + 'start tag': '{br}', + 'start html': '
', + '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)