espacios entre acordes consecutivos

This commit is contained in:
Carlos Galindo 2022-11-21 19:49:54 +01:00
parent d41e4d2824
commit 8de0a025b5

View file

@ -182,6 +182,8 @@ class Chord:
ignore = False ignore = False
continue continue
if "A" <= char <= "G": if "A" <= char <= "G":
if len(self.items) > 0 and not self.items[-1]['text'].endswith("&nbsp;"):
self.items[-1]['text'] += "&nbsp;"
if len(text) > i + 1 and (text[i + 1] == "#" or text[i + 1] == "&"): if len(text) > i + 1 and (text[i + 1] == "#" or text[i + 1] == "&"):
self.items.append({'text': chord_eng2lat(char + text[i + 1]), 'chord': True}) self.items.append({'text': chord_eng2lat(char + text[i + 1]), 'chord': True})
ignore = True ignore = True
@ -189,6 +191,9 @@ class Chord:
self.items.append({'text': chord_eng2lat(char), 'chord': True}) self.items.append({'text': chord_eng2lat(char), 'chord': True})
else: else:
self.items.append({'text': char, 'chord': False}) self.items.append({'text': char, 'chord': False})
if len(self.items) > 0 and not self.items[-1]['text'].endswith("&nbsp;"):
self.items[-1]['text'] += "&nbsp;"
def __str__(self): def __str__(self):
return self.text return self.text