Browse Source

L'appel à la commande songbook.py peut se faire depuis n'importe où.

pull/20/head
Luthaf 11 years ago
parent
commit
6379e95e17
  1. 22
      songbook/build.py
  2. 0
      tex/latex/chords.tex
  3. 0
      tex/latex/crepbook.cls
  4. 0
      tex/latex/licence.sty
  5. 0
      tex/latex/license-nb.tex
  6. 0
      tex/latex/license.tex
  7. 0
      tex/latex/songs.sty
  8. 0
      tex/latex/venturisold.sty
  9. 0
      tex/latex/xstring.sty
  10. 0
      tex/latex/xstring.tex

22
songbook/build.py

@ -55,9 +55,9 @@ def formatDeclaration(name, parameter):
def formatDefinition(name, value):
return '\\set@{name}{{{value}}}\n'.format(name=name, value=value)
def makeTexFile(sb, library, output):
def makeTexFile(sb, library, output, core_dir):
name = output[:-4]
template_dir = core_dir+'templates/'
# default value
template = "patacrep.tmpl"
songs = []
@ -67,7 +67,7 @@ def makeTexFile(sb, library, output):
authwords_tex = ""
authwords = {"after": ["by"], "ignore": ["unknown"], "sep": ["and"]}
# parse the songbook data
if "template" in sb:
template = sb["template"]
@ -111,7 +111,7 @@ def makeTexFile(sb, library, output):
Song.prefixes = prefixes
Song.authwords = authwords
parameters = parseTemplate("templates/"+template)
parameters = parseTemplate(template_dir+template)
# compute songslist
if songs == "all":
@ -142,15 +142,15 @@ def makeTexFile(sb, library, output):
# output template
commentPattern = re.compile(r"^\s*%")
f = open("templates/"+template)
f = open(template_dir+template)
content = [ line for line in f if not commentPattern.match(line) ]
for index, line in enumerate(content):
if re.compile("getLibraryImgDirectory").search(line):
line = line.replace("\\getLibraryImgDirectory", library + "img/")
line = line.replace("\\getLibraryImgDirectory", core_dir + "img/")
content[index] = line
if re.compile("getLibraryLilypondDirectory").search(line):
line = line.replace("\\getLibraryLilypondDirectory", library + "lilypond/")
line = line.replace("\\getLibraryLilypondDirectory", core_dir + "lilypond/")
content[index] = line
f.close()
@ -168,12 +168,16 @@ def buildsongbook(sb, basename, library):
- basename: basename of the songbook to be built.
"""
MOD_DIR = os.path.dirname(os.path.abspath(__file__))
CORE_DIR = MOD_DIR + '/../'
texFile = basename + ".tex"
pdfFile = basename + ".pdf"
# Make TeX file
makeTexFile(sb, library, texFile)
makeTexFile(sb, library, texFile, CORE_DIR)
os.environ['TEXMFHOME'] = MOD_DIR + '/../'
# First pdflatex pass
call(["pdflatex", texFile])

0
tex/chords.tex → tex/latex/chords.tex

0
tex/crepbook.cls → tex/latex/crepbook.cls

0
tex/licence.sty → tex/latex/licence.sty

0
tex/license-nb.tex → tex/latex/license-nb.tex

0
tex/license.tex → tex/latex/license.tex

0
tex/songs.sty → tex/latex/songs.sty

0
tex/venturisold.sty → tex/latex/venturisold.sty

0
tex/xstring.sty → tex/latex/xstring.sty

0
tex/xstring.tex → tex/latex/xstring.tex

Loading…
Cancel
Save