Remove chords from the slide controller and the display

This commit is contained in:
Raoul Snyman 2019-08-29 14:08:37 -07:00
parent 302736357a
commit eed89c4024
2 changed files with 13 additions and 2 deletions

View File

@ -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'])

View File

@ -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)