Browse Source

Simplified json storage format for template parameters.

remotes/origin/translate_notes
Alexandre Dupas 15 years ago
parent
commit
f17bc5e9a4
  1. 5
      songbook.py
  2. 25
      templates/songbook.tmpl

5
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:

25
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}

Loading…
Cancel
Save