Browse Source

Merge pull request #166 from patacrep/songs_package

Update song package
pull/169/head
Louis 9 years ago
parent
commit
462b16b78b
  1. 8
      patacrep/authors.py
  2. 2
      patacrep/data/latex/crepbook.sty
  3. 2
      patacrep/data/latex/patacrep.sty
  4. 775
      patacrep/data/latex/songs.sty
  5. 2
      test/test_authors.py

8
patacrep/authors.py

@ -39,14 +39,15 @@ def compile_authwords(authwords):
def split_author_names(string):
r"""Split author between first and last name.
The last space separates first and last name. LaTeX commands are ignored.
The last space separates first and last name.
LaTeX commands are ignored, escaped spaces are converted to ~.
>>> split_author_names("Edgar Allan Poe")
('Poe', 'Edgar Allan')
>>> split_author_names("Edgar Allan \emph {Poe}")
('{Poe}', 'Edgar Allan \\emph')
>>> split_author_names(r"The Rolling\ Stones")
('Stones', 'The Rolling\\')
('Rolling~Stones', 'The')
>>> split_author_names("The {Rolling Stones}")
('Stones}', 'The {Rolling')
>>> split_author_names("The Rolling Stones")
@ -54,7 +55,8 @@ def split_author_names(string):
>>> split_author_names(" John Doe ")
('Doe', 'John')
"""
chunks = string.strip().split(" ")
chunks = string.strip().replace("\\ ", "~")
chunks = chunks.split(" ")
return (chunks[-1].strip(), " ".join(chunks[:-1]).strip())

2
patacrep/data/latex/crepbook.sty

@ -189,7 +189,7 @@
\transpose{#1}%
\fi%
\mbox{%
\includegraphics[height=\capoheight]{capodastre}%
\includegraphics[height=\capoheight]{img/capodastre}%
\put(-22,8){\Large #1}
}%
}

2
patacrep/data/latex/patacrep.sty

@ -161,7 +161,7 @@
{\bfseries\showauthors}
{\footnotesize\it\songalbum}
\IfStrEq{\songurl}{}{}{
\href{\songurl}{\includegraphics[width=.3cm]{internet}}
\href{\songurl}{\includegraphics[width=.3cm]{img/internet}}
}
}

775
patacrep/data/latex/songs.sty

File diff suppressed because it is too large

2
test/test_authors.py

@ -17,7 +17,7 @@ SPLIT_AUTHORS_DATA = [
("The mamas and the papas", ("mamas and the papas", "The")), # Unbreakable spaces
(r"\LaTeX command", ("command", r"\LaTeX")), # LaTeX commands are ignored
(r"\emph{Some braces}", ("braces}", r"\emph{Some")), # LaTeX commands are ignored
(r"The Rolling\ Stones", ("Stones", 'The Rolling\\')), # LaTeX commands are ignored
(r"The Rolling\ Stones", ("Rolling~Stones", 'The')), # Escaped spaces are converted
]
PROCESS_AUTHORS_DATA = [

Loading…
Cancel
Save