4 words instead of 3 in the chord
Leonardo Robol [2009-04-12 09:24]
4 words instead of 3 in the chord
diff --git a/latex_manager.py b/latex_manager.py
index 080cc7b..5ccdc02 100644
--- a/latex_manager.py
+++ b/latex_manager.py
@@ -14,6 +14,8 @@ class latex_manager():
year = song.year
body = song.body
+ # We really have to assume that latex_song is unicode,
+ # or the write() function will eat us!
latex_song = unicode()
latex_song += "\\begin{song}{" + title + "}{" + tone + "}\n{" + mauthor + "}\n{" + tauthor + "}\n{" + year + "}" + "{}\n\n\\index{" + title + "}\n\n"
@@ -29,8 +31,13 @@ class latex_manager():
latex_song += "\n\\end{song}\n\n"
+ # Transform chords in LaTeX Chords
latex_song = re.sub("\[", "\\Ch{", latex_song)
+ latex_song = re.sub("\](\w|\s)(\w|\s)(\w|\s)(\w|\s)", self.quadra_to_chord_end, latex_song)
latex_song = re.sub("\]", "}{}", latex_song)
return latex_song
+ def quadra_to_chord_end(self,m):
+ st = "}{" + m.group(1) + m.group(2) + m.group(3) + m.group(4) + "}"
+ return st