regex fixes, NEOLATIN_NOTES would introduce an extra capturing group, while ENGLISH_NOTES and GERMAN_NOTES would not

This commit is contained in:
STEPHANVS 2021-07-07 11:26:34 +02:00
parent 7b93fec889
commit 3311d0e5c5
No known key found for this signature in database
GPG Key ID: 4EFE47E471FD62A9

View File

@ -44,9 +44,9 @@ from openlp.core.lib.formattingtags import FormattingTags
log = logging.getLogger(__name__)
ENGLISH_NOTES = '(C|D|E|F|G|A|B|N.C.)?'
GERMAN_NOTES = '(C|D|E|F|G|A|B|H|N.C.)?'
NEOLATIN_NOTES = '(Do|Re|Mi|Fa|Sol|La|Si|N.C.)?'
ENGLISH_NOTES = '(C|D|E|F|G|A|B|N\\.C\\.)?'
GERMAN_NOTES = '(C|D|E|F|G|A|B|H|N\\.C\\.)?'
NEOLATIN_NOTES = '(Do|Re|Mi|Fa|Sol|La|Si|N\\.C\\.)?'
CHORD_PREFIXES = '(=|\\(|\\|)*?'
CHORD_SUFFIXES = '(b|#|x|\\+|-|M|m|Maj|maj|min|sus|dim|add|aug|dom|0|1|2|3|4|5|6|7|8|9|\\(|\\)|no|omit)*?'
SLIM_CHARS = 'fiíIÍjlĺľrtť.,;/ ()|"\'!:\\'
@ -188,11 +188,11 @@ def render_chords_in_line(match):
# The actual chord, would be "G" in match "[G]sweet the "
chord = match.group(1)
# The tailing word of the chord, would be "sweet" in match "[G]sweet the "
tail = match.group(6)
tail = match.group(8)
# The remainder of the line, until line end or next chord. Would be " the " in match "[G]sweet the "
remainder = match.group(7)
remainder = match.group(9)
# Line end if found, else None
end = match.group(8)
end = match.group(10)
# Based on char width calculate width of chord
for chord_char in chord:
if chord_char not in SLIM_CHARS: