openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #34586
[Merge] lp:~raoul-snyman/openlp/fix-display-chords into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/fix-display-chords into lp:openlp.
Commit message:
Fix chords in songs being displayed on the display screen and in the slide controller.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/fix-display-chords/+merge/372026
Fix chords in songs being displayed on the display screen and in the slide controller.
--
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/fix-display-chords into lp:openlp.
=== modified file 'openlp/core/display/render.py'
--- openlp/core/display/render.py 2019-08-06 20:46:41 +0000
+++ openlp/core/display/render.py 2019-08-29 21:10:52 +0000
@@ -67,6 +67,15 @@
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 @@
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 @@
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'])
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py 2019-05-24 22:11:11 +0000
+++ openlp/core/lib/serviceitem.py 2019-08-29 21:10:52 +0000
@@ -185,7 +185,7 @@
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)
Follow ups