diff --git a/openlp/core/display/render.py b/openlp/core/display/render.py index 5e41c8174..e74a66e73 100644 --- a/openlp/core/display/render.py +++ b/openlp/core/display/render.py @@ -67,6 +67,15 @@ FOOTER_COPYRIGHT = 'Public Domain' CCLI_NO = '123456' +def remove_chords(text): + """ + Remove chords from the text + + :param text: Text to be cleaned + """ + return re.sub(r'\[.+?\]', r'', text) + + def remove_tags(text, can_remove_chords=False): """ Remove Tags from text for display @@ -82,7 +91,7 @@ def remove_tags(text, can_remove_chords=False): text = text.replace(tag['end tag'], '') # Remove ChordPro tags if can_remove_chords: - text = re.sub(r'\[.+?\]', r'', text) + text = remove_chords(text) return text @@ -377,6 +386,8 @@ def render_tags(text, can_render_chords=False, is_printing=False): text = render_chords_for_printing(text, '{br}') else: text = render_chords(text) + else: + text = remove_chords(text) for tag in FormattingTags.get_html_tags(): text = text.replace(tag['start tag'], tag['start html']) text = text.replace(tag['end tag'], tag['end html']) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 3366cd858..fc261fc94 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -185,7 +185,7 @@ class ServiceItem(RegistryProperties): self._rendered_slides.append(rendered_slide) display_slide = { 'title': raw_slide['title'], - 'text': remove_tags(page), + 'text': remove_tags(page, can_remove_chords=True), 'verse': verse_tag, } self._display_slides.append(display_slide)