|
|
@ -78,8 +78,13 @@ def lilyfy(string): |
|
|
|
This is extended on a as-needed basis. |
|
|
|
""" |
|
|
|
|
|
|
|
string = string.replace('"', '\\"') |
|
|
|
if not string: |
|
|
|
return "" |
|
|
|
|
|
|
|
if string.startswith("\\markup"): |
|
|
|
return string #trust the user |
|
|
|
|
|
|
|
string = string.replace('"', '\\"') |
|
|
|
return string |
|
|
|
|
|
|
|
def fromTemplate(session, templateFile, data, meta, tempoStaff): |
|
|
@ -99,7 +104,7 @@ def fromTemplate(session, templateFile, data, meta, tempoStaff): |
|
|
|
templateString = templateString.replace("%$$DATE$$", da.today().strftime("%A %d. %B %Y")) #The current date |
|
|
|
templateString = templateString.replace("%$$FILENAME$$", session.sessionPrefix) |
|
|
|
templateString = templateString.replace("%$$HEADER$$", processMeta(meta)) |
|
|
|
templateString = templateString.replace("%$$SUBTEXT$$", lilyfy(meta["subtext"])) |
|
|
|
templateString = templateString.replace("%$$SUBTEXT$$", '"' + lilyfy(meta["subtext"]) + '"') |
|
|
|
voicesString, structureString = processData(data) |
|
|
|
templateString = templateString.replace("%$$VOICES$$", voicesString) |
|
|
|
templateString = templateString.replace("%$$STRUCTURE$$", structureString) |
|
|
@ -159,6 +164,8 @@ def processMeta(meta): |
|
|
|
else: |
|
|
|
return "##f" |
|
|
|
|
|
|
|
metaString = "\n ".join(key + " = " + valueMarkup(value) for key, value in meta.items()) |
|
|
|
#We have more data than lilypond in there. Filter: |
|
|
|
whitelist = ("title", "subtitle", "dedication", "composer", "subsubtitle", "instrument", "meter", "arranger", "poet", "opus", "copyright", "tagline") |
|
|
|
metaString = "\n ".join(key + " = " + valueMarkup(value) for key, value in meta.items() if key in whitelist) |
|
|
|
|
|
|
|
return metaString |
|
|
|