diff --git a/songbook.py b/songbook.py index 97a45095..e8de4b16 100755 --- a/songbook.py +++ b/songbook.py @@ -22,7 +22,10 @@ def parseTemplate(template): code = [ line[3:-1] for line in f if embeddedJsonPattern.match(line) ] f.close() data = json.loads(''.join(code)) - return data["parameters"] + parameters = dict() + for param in data: + parameters[param["name"]] = param + return parameters def toValue(parameter, data): if "type" not in parameter: diff --git a/templates/songbook.tmpl b/templates/songbook.tmpl index a19300db..90a6c564 100644 --- a/templates/songbook.tmpl +++ b/templates/songbook.tmpl @@ -24,19 +24,18 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Template parameters %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -%%:{"parameters" : { -%%: "title" : {"description":"Title", "default":"Recueil de chansons pour guitare"}, -%%: "author" : {"description":"Author", "default":"Romain Goffe \\and Alexandre Dupas"}, -%%: "version" : {"description":"Version", "default":"3.1"}, -%%: "subtitle" : {"description":"Subtitle"}, -%%: "mail" : {"description":"Email", "default":"crep@team-on-fire.com"}, -%%: "picture" : {"description":"Picture", "default":"feel-the-music"}, -%%: "picturecopyright" : {"description":"Copyright", "default":"foxygamergirl@deviantart.com"}, -%%: "footer" : {"description":"Footer", "default":"\\begin{flushleft}\\includegraphics[width=3cm]{on-fire}\\end{flushleft}"}, -%%: "license" : {"description":"License", "default":"\\input{license.tex}"}, -%%: "booktype" : {"description":"Booktype", "type":"stringlist", "default":["chorded"], "join":","} -%%: } -%%:} +%%:[ +%%: {"name":"title", "description":"Title", "default":"Recueil de chansons pour guitare"}, +%%: {"name":"author", "description":"Author", "default":"Romain Goffe \\and Alexandre Dupas"}, +%%: {"name":"version", "description":"Version", "default":"3.1"}, +%%: {"name":"subtitle", "description":"Subtitle"}, +%%: {"name":"mail", "description":"Email", "default":"crep@team-on-fire.com"}, +%%: {"name":"picture", "description":"Picture", "default":"feel-the-music"}, +%%: {"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":","} +%%:] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % begin document \documentclass[\getbooktype]{crepbook}