diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index 5efd7577e..8f89b0c04 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -328,7 +328,7 @@ def find_formatting_tags(text, active_formatting_tags): # See if the found tag has an end tag for formatting_tag in FormattingTags.get_html_tags(): if formatting_tag['start tag'] == '{' + tag + '}': - if formatting_tag['end tag']: + if formatting_tag['end html']: if start_tag: # prepend the new tag to the list of active formatting tags active_formatting_tags[:0] = [tag] @@ -486,8 +486,12 @@ def get_start_tags(raw_text): """ raw_tags = [] html_tags = [] + endless_tags = [] + for formatting_tag in FormattingTags.get_html_tags(): + if not formatting_tag['end html']: + endless_tags.append(formatting_tag['start tag']) for tag in FormattingTags.get_html_tags(): - if tag['start tag'] == '{br}': + if tag['start tag'] in endless_tags: continue if raw_text.count(tag['start tag']) != raw_text.count(tag['end tag']): raw_tags.append((raw_text.find(tag['start tag']), tag['start tag'], tag['end tag'])) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 63b31f2b0..5b5bc3425 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -45,6 +45,7 @@ from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib.db import Author, AuthorType, Book, MediaFile, Song, SongBookEntry, Topic from openlp.plugins.songs.lib.openlyricsxml import SongXML from openlp.plugins.songs.lib.ui import SongStrings +from openlp.core.lib.formattingtags import FormattingTags log = logging.getLogger(__name__) @@ -285,8 +286,12 @@ class EditSongForm(QtWidgets.QDialog, Ui_EditSongDialog, RegistryProperties): """ if first_time: fixed_tags = [] + endless_tags = [] + for formatting_tag in FormattingTags.get_html_tags(): + if not formatting_tag['end html']: + endless_tags.append(formatting_tag['start tag']) for i in range(len(tags)): - if tags[i] != '{br}': + if tags[i] not in endless_tags: fixed_tags.append(tags[i]) tags = fixed_tags if len(tags) == 0: diff --git a/openlp/plugins/songs/lib/openlyricsxml.py b/openlp/plugins/songs/lib/openlyricsxml.py index 984e41960..5012a2bba 100644 --- a/openlp/plugins/songs/lib/openlyricsxml.py +++ b/openlp/plugins/songs/lib/openlyricsxml.py @@ -355,8 +355,12 @@ class OpenLyrics(object): {st}{r}Text text text """ tags = [] + endless_tags = [] + for formatting_tag in FormattingTags.get_html_tags(): + if not formatting_tag['end html']: + endless_tags.append(formatting_tag['start tag']) for tag in FormattingTags.get_html_tags(): - if tag['start tag'] == '{br}': + if tag['start tag'] in endless_tags: continue if text.count(tag['start tag']) != text.count(tag['end tag']): tags.append((text.find(tag['start tag']), tag['start tag'], tag['end tag'])) @@ -450,7 +454,7 @@ class OpenLyrics(object): # Check if formatting tag contains end tag. Some formatting # tags e.g. {br} has only start tag. If no end tag is present # element has not to be in OpenLyrics xml. - if tag['end tag']: + if tag['end html']: element_close = self._add_text_to_element('close', element) element_close.text = etree.CDATA(tag['end html'])