|
@ -57,9 +57,7 @@ class Songbook(object): |
|
|
'lang': 'english', |
|
|
'lang': 'english', |
|
|
'sort': [u"by", u"album", u"@title"], |
|
|
'sort': [u"by", u"album", u"@title"], |
|
|
'content': None, |
|
|
'content': None, |
|
|
'datadir': os.path.abspath('.'), |
|
|
|
|
|
} |
|
|
} |
|
|
self.songslist = None |
|
|
|
|
|
self._parse_raw(raw_songbook) |
|
|
self._parse_raw(raw_songbook) |
|
|
|
|
|
|
|
|
@staticmethod |
|
|
@staticmethod |
|
@ -94,7 +92,7 @@ class Songbook(object): |
|
|
are stored verbatim in self.config. |
|
|
are stored verbatim in self.config. |
|
|
""" |
|
|
""" |
|
|
self.config.update(raw_songbook) |
|
|
self.config.update(raw_songbook) |
|
|
self.config['datadir'] = os.path.abspath(self.config['datadir']) |
|
|
self._set_datadir() |
|
|
|
|
|
|
|
|
# Compute song list |
|
|
# Compute song list |
|
|
if self.config['content'] is None: |
|
|
if self.config['content'] is None: |
|
@ -129,6 +127,23 @@ class Songbook(object): |
|
|
if key not in self.config['authwords']: |
|
|
if key not in self.config['authwords']: |
|
|
self.config['authwords'][key] = value |
|
|
self.config['authwords'][key] = value |
|
|
|
|
|
|
|
|
|
|
|
def _set_datadir(self): |
|
|
|
|
|
"""Set the default values for datadir""" |
|
|
|
|
|
try: |
|
|
|
|
|
if isinstance(self.config['datadir'], str) or \ |
|
|
|
|
|
isinstance(self.config['datadir'], unicode): |
|
|
|
|
|
self.config['datadir'] = [self.config['datadir']] |
|
|
|
|
|
except KeyError: # No datadir in the raw_songbook |
|
|
|
|
|
self.config['datadir'] = [os.path.abspath('.')] |
|
|
|
|
|
|
|
|
|
|
|
abs_datadir = [] |
|
|
|
|
|
for path in self.config['datadir']: |
|
|
|
|
|
abs_datadir.append(os.path.abspath(path)) |
|
|
|
|
|
|
|
|
|
|
|
abs_datadir.append(__DATADIR__) |
|
|
|
|
|
|
|
|
|
|
|
self.config['datadir'] = abs_datadir |
|
|
|
|
|
|
|
|
def _parse_songs(self): |
|
|
def _parse_songs(self): |
|
|
"""Parse content included in songbook.""" |
|
|
"""Parse content included in songbook.""" |
|
|
self.contentlist = SongbookContent(self.config['datadir']) |
|
|
self.contentlist = SongbookContent(self.config['datadir']) |
|
@ -186,18 +201,7 @@ class SongbookBuilder(object): |
|
|
return self._called_functions[function] |
|
|
return self._called_functions[function] |
|
|
|
|
|
|
|
|
def _set_latex(self): |
|
|
def _set_latex(self): |
|
|
"""Set TEXINPUTS and LaTeX options.""" |
|
|
"""Set LaTeX options.""" |
|
|
if not 'TEXINPUTS' in os.environ.keys(): |
|
|
|
|
|
os.environ['TEXINPUTS'] = '' |
|
|
|
|
|
os.environ['TEXINPUTS'] += os.pathsep + os.path.join( |
|
|
|
|
|
__DATADIR__, |
|
|
|
|
|
'latex', |
|
|
|
|
|
) |
|
|
|
|
|
os.environ['TEXINPUTS'] += os.pathsep + os.path.join( |
|
|
|
|
|
self.songbook.config['datadir'], |
|
|
|
|
|
'latex', |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if self.unsafe: |
|
|
if self.unsafe: |
|
|
self._pdflatex_options.append("--shell-escape") |
|
|
self._pdflatex_options.append("--shell-escape") |
|
|
if not self.interactive: |
|
|
if not self.interactive: |
|
|