diff --git a/songbook.py b/songbook.py index ca3489db..01952d2e 100755 --- a/songbook.py +++ b/songbook.py @@ -38,6 +38,14 @@ def toValue(parameter, data): return joinText.join(data) elif parameter["type"] == "color": return data[1:] + elif parameter["type"] == "enum": + return data + elif parameter["type"] == "flag": + if "join" in parameter: + joinText = parameter["join"] + else: + joinText = '' + return joinText.join(data) def formatDeclaration(name, parameter): value = "" @@ -111,7 +119,7 @@ def makeDepend(sb, output): # check for lilypond deps (in songs data) if necessary lilypond = [] - if "booktype" in sb and "lilypond" in sb["booktype"]: + if "bookoptions" in sb and "lilypond" in sb["bookoptions"]: for filename in deps: tmpl = open(filename) lilypond += matchRegexp(lilypondPattern, tmpl) diff --git a/templates/minimal.tmpl b/templates/minimal.tmpl index 35ab9924..74c642fa 100644 --- a/templates/minimal.tmpl +++ b/templates/minimal.tmpl @@ -25,7 +25,12 @@ % Template parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%:[ -%%: {"name":"booktype", "description":"Booktype", "type":"stringlist", "default":["chorded"], "join":","} +%%: {"name":"booktype", "description":"Type", "type":"enum", "values":["chorded","lyric"], "default":"chorded", "mandatory":true}, +%%: {"name":"bookoptions", "description":"Options", "type":"flag", "values":["diagram","lilypond","tabs"], "join":",", "mandatory":true, "default":["diagram"]}, +%%: {"name":"mainfontsize", "description":"Font Size", "type":"enum", "values":["10pt","11pt","12pt"], "default":"10pt"}, +%%: {"name":"songnumberbgcolor", "description":"Number Shade", "type":"color", "default":"#D1E4AE"}, +%%: {"name":"notebgcolor", "description":"Note Shade", "type":"color", "default":"#D1E4AE"}, +%%: {"name":"indexbgcolor", "description":"Index Shade", "type":"color", "default":"#D1E4AE"} %%:] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % begin document diff --git a/templates/patacrep.tmpl b/templates/patacrep.tmpl index b7c28d3b..761aa946 100644 --- a/templates/patacrep.tmpl +++ b/templates/patacrep.tmpl @@ -25,8 +25,10 @@ % Template parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%:[ -%%: {"name":"title", "description":"Title", "default":"Recueil de chansons pour guitare"}, -%%: {"name":"author", "description":"Author", "default":"Romain Goffe \\and Alexandre Dupas"}, +%%: {"name":"title", "description":"Title", "default":"Recueil de chansons pour guitare", "mandatory":true}, +%%: {"name":"author", "description":"Author", "default":"Romain Goffe \\and Alexandre Dupas", "mandatory":true}, +%%: {"name":"booktype", "description":"Type", "type":"enum", "values":["chorded","lyric"], "default":"chorded", "mandatory":true}, +%%: {"name":"bookoptions", "description":"Options", "type":"flag", "values":["diagram","lilypond","tabs"], "join":",", "mandatory":true, "default":["diagram"]}, %%: {"name":"version", "description":"Version", "default":"3.2"}, %%: {"name":"subtitle", "description":"Subtitle"}, %%: {"name":"web", "description":"Web", "default":"http://www.patacrep.com"}, @@ -35,7 +37,6 @@ %%: {"name":"picturecopyright", "description":"Copyright", "default":"foxygamergirl@deviantart.com"}, %%: {"name":"footer", "description":"Footer", "default":"\\begin{flushleft}\\includegraphics[width=3cm]{on-fire}\\end{flushleft}"}, %%: {"name":"license", "description":"License", "default":"\\input{license.tex}"}, -%%: {"name":"booktype", "description":"Booktype", "type":"stringlist", "default":["chorded"], "join":","}, %%: {"name":"mainfontsize", "description":"Font Size", "values":["10pt","11pt","12pt"], "default":"10pt"}, %%: {"name":"songnumberbgcolor", "description":"Number Shade", "type":"color", "default":"#D1E4AE"}, %%: {"name":"notebgcolor", "description":"Note Shade", "type":"color", "default":"#D1E4AE"},