forked from openlp/openlp
Even more test fixes
This commit is contained in:
parent
5f9af7daa3
commit
daf87bd268
@ -47,8 +47,8 @@ log = logging.getLogger(__name__)
|
|||||||
ENGLISH_NOTES = '[CDEFGAB]?'
|
ENGLISH_NOTES = '[CDEFGAB]?'
|
||||||
GERMAN_NOTES = '[CDEFGABH]?'
|
GERMAN_NOTES = '[CDEFGABH]?'
|
||||||
NEOLATIN_NOTES = '(Do|Re|Mi|Fa|Sol|La|Si)?'
|
NEOLATIN_NOTES = '(Do|Re|Mi|Fa|Sol|La|Si)?'
|
||||||
CHORD_PREFIXES = '(=|\(|\|)*?'
|
CHORD_PREFIXES = '(=|\\(|\\|)*?'
|
||||||
CHORD_SUFFIXES = '(b|bb|#|##|x|-|m|maj|min|sus|dim|0|1|2|3|4|5|6|7|8|9|\))*?'
|
CHORD_SUFFIXES = '(b|bb|#|##|x|-|m|maj|min|sus|dim|0|1|2|3|4|5|6|7|8|9|\\))*?'
|
||||||
SLIM_CHARS = 'fiíIÍjlĺľrtť.,;/ ()|"\'!:\\'
|
SLIM_CHARS = 'fiíIÍjlĺľrtť.,;/ ()|"\'!:\\'
|
||||||
CHORD_TEMPLATE = '<span class="chordline">{chord}</span>'
|
CHORD_TEMPLATE = '<span class="chordline">{chord}</span>'
|
||||||
FIRST_CHORD_TEMPLATE = '<span class="chordline">{chord}</span>'
|
FIRST_CHORD_TEMPLATE = '<span class="chordline">{chord}</span>'
|
||||||
@ -80,7 +80,7 @@ def _construct_chord_regex(notes):
|
|||||||
:param notes: The regular expression for a set of valid notes
|
:param notes: The regular expression for a set of valid notes
|
||||||
:return: An expanded regular expression for valid chords
|
:return: An expanded regular expression for valid chords
|
||||||
"""
|
"""
|
||||||
#chord = CHORD_PREFIXES + notes + CHORD_SUFFIXES
|
# chord = CHORD_PREFIXES + notes + CHORD_SUFFIXES
|
||||||
return '(' + CHORD_PREFIXES + notes + CHORD_SUFFIXES + '(/' + notes + CHORD_SUFFIXES + ')?)'
|
return '(' + CHORD_PREFIXES + notes + CHORD_SUFFIXES + '(/' + notes + CHORD_SUFFIXES + ')?)'
|
||||||
|
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ def render_chords(text):
|
|||||||
rendered_lines.append(new_line)
|
rendered_lines.append(new_line)
|
||||||
else:
|
else:
|
||||||
chords_on_prev_line = False
|
chords_on_prev_line = False
|
||||||
#rendered_lines.append(html.escape(line))
|
# rendered_lines.append(html.escape(line))
|
||||||
chord_template = NO_CHORD_TEMPLATE
|
chord_template = NO_CHORD_TEMPLATE
|
||||||
new_line = chord_template.format(chord=line)
|
new_line = chord_template.format(chord=line)
|
||||||
rendered_lines.append(new_line)
|
rendered_lines.append(new_line)
|
||||||
|
@ -104,7 +104,7 @@ def test_render_chords(settings):
|
|||||||
text_with_rendered_chords = render_chords(text_with_chords)
|
text_with_rendered_chords = render_chords(text_with_chords)
|
||||||
|
|
||||||
# THEN: We should get html that looks like below
|
# THEN: We should get html that looks like below
|
||||||
expected_html = '<span class="chordline firstchordline">H<span class="chord"><span><strong>C</strong></span>' \
|
expected_html = '<span class="chordline">H<span class="chord"><span><strong>C</strong></span>' \
|
||||||
'</span>alleluya.<span class="chord"><span><strong>F</strong></span></span><span class="ws">' \
|
'</span>alleluya.<span class="chord"><span><strong>F</strong></span></span><span class="ws">' \
|
||||||
' </span> <span class="chord"><span><strong>G/B</strong></span></span></span>'
|
' </span> <span class="chord"><span><strong>G/B</strong></span></span></span>'
|
||||||
assert text_with_rendered_chords == expected_html, 'The rendered chords should look as expected'
|
assert text_with_rendered_chords == expected_html, 'The rendered chords should look as expected'
|
||||||
|
Loading…
Reference in New Issue
Block a user