diff --git a/patacrep/authors.py b/patacrep/authors.py index dfaf9999..3a3e8600 100644 --- a/patacrep/authors.py +++ b/patacrep/authors.py @@ -48,7 +48,7 @@ def split_author_names(string): ignore_space = False last_space = index = 0 brace_count = 0 - for char in string: + for char in string.strip(): index += 1 if brace_count == 0: if char == "\\": diff --git a/patacrep/build.py b/patacrep/build.py index f2f4b270..dc5cdda0 100755 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -4,6 +4,7 @@ """Build a songbook, according to parameters found in a .sb file.""" import codecs +import copy import glob import logging import os.path @@ -95,7 +96,9 @@ class Songbook(object): config.update(renderer.get_variables()) config.update(self.config) - config['authwords'] = authors.compile_authwords(config['authwords']) + config['_compiled_authwords'] = authors.compile_authwords( + copy.deepcopy(config['authwords']) + ) self.config = config # Configuration set @@ -105,7 +108,6 @@ class Songbook(object): self.config, ) self.config['render_content'] = content.render_content - self.config['titleprefixkeys'] = ["after", "sep", "ignore"] self.config['content'] = self.contentlist self.config['filename'] = output.name[:-4] diff --git a/patacrep/data/templates/default.tex b/patacrep/data/templates/default.tex index 939696d1..1a2bf26a 100644 --- a/patacrep/data/templates/default.tex +++ b/patacrep/data/templates/default.tex @@ -86,18 +86,18 @@ \newauthorindex{authidx}{((filename))_auth} (* for prefix in titleprefixwords *) - \titleprefixword{((prefix))} + \titleprefixword{((prefix))} (* endfor*) - (* for key in titleprefixkeys *) - (* for word in authwords.key *) - (* if key=="after" *) - \authbyword{((word))} - (* else *) - \auth((key))word{((word))} - (* endif *) - (* endfor *) - (* endfor*) - + (* for word in authwords.ignore *) + \authignoreword{((word))} + (* endfor *) + (* for word in authwords.after *) + \authbyword{((word))} + (* endfor *) + (* for word in authwords.sep *) + \authsepword{((word))} + (* endfor *) + (* if notenamesout=="alphascale" *) \notenamesout{A}{B}{C}{D}{E}{F}{G} (* else *) diff --git a/patacrep/songs.py b/patacrep/songs.py index d62cbe64..2cc49846 100755 --- a/patacrep/songs.py +++ b/patacrep/songs.py @@ -31,7 +31,7 @@ class Song(object): if "by" in self.args.keys(): self.authors = processauthors( self.args["by"], - **config["authwords"] + **config["_compiled_authwords"] ) else: self.authors = []