Browse Source

[WIP] Song languages work

pull/47/head
Louis 11 years ago
parent
commit
e7519bce75
  1. 6
      songbook_core/content/song.py
  2. 7
      songbook_core/data/templates/songs.tex

6
songbook_core/content/song.py

@ -34,6 +34,8 @@ class SongRenderer(Content, Song):
return r'\input{{{}}}'.format(path)
def parse(keyword, config, *arguments):
if 'languages' not in config:
config['languages'] = set()
songlist = []
if not arguments:
arguments = [
@ -52,7 +54,9 @@ def parse(keyword, config, *arguments):
for songdir in [os.path.join(d, 'songs') for d in config['datadir']]:
for filename in glob.iglob(os.path.join(songdir, elem)):
LOGGER.debug('Parsing file "{}"'.format(filename))
songlist.append(SongRenderer(filename))
song = SongRenderer(filename)
songlist.append(song)
config["languages"].update(song.languages)
if len(songlist) > before:
break
if len(songlist) == before:

7
songbook_core/data/templates/songs.tex

@ -70,10 +70,9 @@
(* block songbookpreambule *)
(( super() ))
%!TODO
%!(* for lang in content.languages() *)
%!\PassOptionsToPackage{((lang))}{babel}
%!(* endfor *)
(* for lang in languages *)
\PassOptionsToPackage{((lang))}{babel}
(* endfor *)
\usepackage[((lang))]{babel}
\lang{((lang))}

Loading…
Cancel
Save