Support "add" in chord suffix, support song key definition with "="

This commit is contained in:
STEPHANVS 2021-07-05 15:43:32 +02:00
parent 41344390f5
commit 0fc81b8efb
No known key found for this signature in database
GPG Key ID: 4EFE47E471FD62A9
2 changed files with 7 additions and 1 deletions

View File

@ -48,7 +48,7 @@ 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|add|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>'

View File

@ -640,6 +640,12 @@ def transpose_chord(chord, transpose_value, notation):
current_chord = current_chord[1:] current_chord = current_chord[1:]
else: else:
current_chord = '' current_chord = ''
if current_chord and current_chord[0] == '=':
transposed_chord += '='
if len(current_chord) > 1:
current_chord = current_chord[1:]
else:
current_chord = ''
if len(current_chord) > 0: if len(current_chord) > 0:
if len(current_chord) > 1: if len(current_chord) > 1:
if '#b'.find(current_chord[1]) == -1: if '#b'.find(current_chord[1]) == -1: