Browse Source

Merge branch 'next' into packages : Pour prendre en compte les dernières modifications dans les paquets LaTeX

pull/32/head
Louis 11 years ago
parent
commit
33688ba848
  1. 10
      setup.cfg
  2. 10
      songbook
  3. 7
      songbook_core/build.py
  4. 436
      songbook_core/data/latex/chords.sty
  5. 30
      songbook_core/data/latex/venturisold.sty
  6. 1168
      songbook_core/data/latex/xstring.sty
  7. 16
      songbook_core/data/templates/default.tex
  8. 2
      songbook_core/data/templates/layout.tex
  9. 27
      songbook_core/index.py
  10. 5
      songbook_core/plastex.py
  11. 110
      songbook_core/plastex_chord.py
  12. 6
      stdeb.cfg

10
setup.cfg

@ -0,0 +1,10 @@
[bdist_rpm]
requires = python >= 2.7
python-unidecode
python-jinja2
texlive
texlive-framed
texlive-nfssext-cfr
lilypond

10
songbook

@ -100,8 +100,14 @@ def main():
basename = os.path.basename(songbook_path)[:-3] basename = os.path.basename(songbook_path)[:-3]
with open(songbook_path) as songbook_file: try:
songbook = json.load(songbook_file) with open(songbook_path) as songbook_file:
songbook = json.load(songbook_file)
except Exception as error: # pylint: disable=broad-except
LOGGER.error(error)
LOGGER.error("Error while loading file '{}'.".format(songbook_path))
sys.exit(1)
if options.datadir is not None: if options.datadir is not None:
songbook['datadir'] = options.datadir[0] songbook['datadir'] = options.datadir[0]

7
songbook_core/build.py

@ -244,8 +244,11 @@ class SongbookBuilder(object):
self._run_once(self._set_latex) self._run_once(self._set_latex)
process = Popen( process = Popen(
["pdflatex"] + self._pdflatex_options + [self.basename], ["pdflatex"] + self._pdflatex_options + [self.basename],
stdin=PIPE,
stdout=PIPE, stdout=PIPE,
stderr=PIPE) stderr=PIPE)
if not self.interactive:
process.stdin.close()
log = '' log = ''
line = process.stdout.readline() line = process.stdout.readline()
while line: while line:
@ -265,8 +268,8 @@ class SongbookBuilder(object):
for sxd_file in sxd_files: for sxd_file in sxd_files:
LOGGER.debug("Processing " + sxd_file) LOGGER.debug("Processing " + sxd_file)
idx = process_sxd(sxd_file) idx = process_sxd(sxd_file)
with open(sxd_file[:-3] + "sbx", "w") as index_file: with codecs.open(sxd_file[:-3] + "sbx", "w", "utf-8") as index_file:
index_file.write(idx.entries_to_str().encode('utf8')) index_file.write(idx.entries_to_str())
@staticmethod @staticmethod
def build_custom(command): def build_custom(command):

436
songbook_core/data/latex/chords.sty

@ -1,53 +1,37 @@
% Chords package for patacrep songbook % Chords package for patacrep songbook
% define commands for chord display : guitar chords (\gtab) and ukulele chords (\utab) % Define command \chords to display list of chords, for guitar or ukulele
\ProvidesPackage{chords} \ProvidesPackage{chords}
\RequirePackage{songs}
\newcommand*{\Sharp}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small\bf \#}} \newcommand*{\Sharp}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small\bf \#}}
\newcommand*{\Flat}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small$\mathbf{\flat}$}} \newcommand*{\Flat}{\nolinebreak\hspace{-.05em}\raisebox{.6ex}{\,\small$\mathbf{\flat}$}}
\newcommand*{\chordrule}{\mbox{\hspace{1cm}\rule[0.5cm]{15cm}{0.02cm}}\vspace{-.4cm}} \newcommand*{\chordrule}{\mbox{\hspace{1cm}\rule[0.5cm]{15cm}{0.02cm}}\vspace{-.4cm}}
\newcommand*{\chordname}[1]{\makebox[3cm]{\raisebox{.5cm}{\large \textbf{#1}}}} \newcommand*{\chordname}[1]{\makebox[3cm]{\raisebox{.5cm}{\large \textbf{#1}}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\chordnameAsharp}{\printnoteA{}\Sharp = \printnoteB{}\Flat}
% Multilanguage management \newcommand{\chordnameA}{\printnoteA{}}
\newcommand{\chordnameB}{\printnoteB{}}
\newcommand{\chordnameCsharp}{\printnoteC{}\Sharp = \printnoteD{}\Flat}
\newcommand{\chordnameC}{\printnoteC{}}
\newcommand{\chordnameDsharp}{\printnoteD{}\Sharp = \printnoteE{}\Flat}
\newcommand{\chordnameD}{\printnoteD{}}
\newcommand{\chordnameE}{\printnoteE{}}
\newcommand{\chordnameFsharp}{\printnoteF{}\Sharp = \printnoteG{}\Flat}
\newcommand{\chordnameF}{\printnoteF{}}
\newcommand{\chordnameGsharp}{\printnoteG{}\Sharp = \printnoteA{}\Flat}
\newcommand{\chordnameG}{\printnoteG{}}
\AtBeginDocument{ \AtBeginDocument{
% Default names (english) % Default names (english)
\newcommand{\guitarchordsname}{Guitar chords} \newcommand{\guitarchordsname}{Guitar chords}
\newcommand{\ukulelechordsname}{Ukulele chords} \newcommand{\ukulelechordsname}{Ukulele chords}
\newcommand{\chordnameAsharp}{A\Sharp = B\Flat}
\newcommand{\chordnameA}{A}
\newcommand{\chordnameB}{B}
\newcommand{\chordnameCsharp}{C\Sharp = D\Flat}
\newcommand{\chordnameC}{C}
\newcommand{\chordnameDsharp}{D\Sharp = E\Flat}
\newcommand{\chordnameD}{D}
\newcommand{\chordnameE}{E}
\newcommand{\chordnameFsharp}{F\Sharp = G\Flat}
\newcommand{\chordnameF}{F}
\newcommand{\chordnameGsharp}{G\Sharp = A\Flat}
\newcommand{\chordnameG}{G}
\IfStrEq{\mainlanguage}{french}{ \IfStrEq{\mainlanguage}{french}{
% French names % French names
\renewcommand{\guitarchordsname}{Accords de guitare} \renewcommand{\guitarchordsname}{Accords de guitare}
\renewcommand{\ukulelechordsname}{Accords de ukulélé} \renewcommand{\ukulelechordsname}{Accords de ukulélé}
\renewcommand{\chordnameAsharp}{La\Sharp = Si\Flat}
\renewcommand{\chordnameA}{La}
\renewcommand{\chordnameB}{Si}
\renewcommand{\chordnameCsharp}{Do\Sharp = Ré\Flat}
\renewcommand{\chordnameC}{Do}
\renewcommand{\chordnameDsharp}{Ré\Sharp = Mi\Flat}
\renewcommand{\chordnameD}{Ré}
\renewcommand{\chordnameE}{Mi}
\renewcommand{\chordnameFsharp}{Fa\Sharp = Sol\Flat}
\renewcommand{\chordnameF}{Fa}
\renewcommand{\chordnameGsharp}{Sol\Sharp = La\Flat}
\renewcommand{\chordnameG}{Sol}
}{} }{}
} }
% End of multilanguage management
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\chords}{ \newcommand{\chords}{
\begin{songs}{} \begin{songs}{}
@ -61,151 +45,151 @@
\ifguitar \ifguitar
\beginsong{\guitarchordsname} \beginsong{\guitarchordsname}
\chordname{\chordnameC} \chordname{\chordnameC}
\gtab{C}{~:X32010} \gtab{\printnoteC{}}{~:X32010}
\gtab{C7}{~:X32310} \gtab{\printnoteC{}7}{~:X32310}
\gtab{Cm}{3:X02210} \gtab{\printnoteC{}m}{3:X02210}
\gtab{Cm7}{3:X02010} \gtab{\printnoteC{}m7}{3:X02010}
\hspace{1cm} \hspace{1cm}
\gtab*{C7M}{~:332000} \gtab*{\printnoteC{}7M}{~:332000}
\gtab*{C4}{~:X32011} \gtab*{\printnoteC{}4}{~:X32011}
\gtab*{C7}{1:X2120X} \gtab*{\printnoteC{}7}{1:X2120X}
\gtab*{C6}{~:XX2213} \gtab*{\printnoteC{}6}{~:XX2213}
\chordrule \chordrule
\chordname{\chordnameCsharp} \chordname{\chordnameCsharp}
\gtab{C\#}{4:X02220} \gtab{\printnoteC{}\#}{4:X02220}
\gtab{C\#7}{4:X02020} \gtab{\printnoteC{}\#7}{4:X02020}
\gtab{C\#m}{4:X02210} \gtab{\printnoteC{}\#m}{4:X02210}
\gtab{C\#m7}{5:XX2213} \gtab{\printnoteC{}\#m7}{5:XX2213}
\hspace{1cm} \hspace{1cm}
\gtab*{C\#7M}{1:X32000} \gtab*{\printnoteC{}\#7M}{1:X32000}
\gtab*{C\#4}{2:X21000} \gtab*{\printnoteC{}\#4}{2:X21000}
\gtab*{C\#7}{2:X2120X} \gtab*{\printnoteC{}\#7}{2:X2120X}
\gtab*{C\#6}{1:X02010} \gtab*{\printnoteC{}\#6}{1:X02010}
\chordrule \chordrule
\chordname{\chordnameD} \chordname{\chordnameD}
\gtab{D}{~:XX0232} \gtab{\printnoteD{}}{~:XX0232}
\gtab{D7}{~:XX0212} \gtab{\printnoteD{}7}{~:XX0212}
\gtab{Dm}{~:XX0231} \gtab{\printnoteD{}m}{~:XX0231}
\gtab{Dm7}{~:XX0211} \gtab{\printnoteD{}m7}{~:XX0211}
\hspace{1cm} \hspace{1cm}
\gtab*{D7M}{~:X00222} \gtab*{\printnoteD{}7M}{~:X00222}
\gtab*{D4}{~:X00233} \gtab*{\printnoteD{}4}{~:X00233}
\gtab*{D7}{3:X2120X} \gtab*{\printnoteD{}7}{3:X2120X}
\gtab*{D6}{~:X00202} \gtab*{\printnoteD{}6}{~:X00202}
\chordrule \chordrule
\chordname{\chordnameDsharp} \chordname{\chordnameDsharp}
\gtab{D\#}{6:X02220} \gtab{\printnoteD{}\#}{6:X02220}
\gtab{D\#7}{6:X02020} \gtab{\printnoteD{}\#7}{6:X02020}
\gtab{D\#m}{6:X02210} \gtab{\printnoteD{}\#m}{6:X02210}
\gtab{D\#m7}{~:XX1322} \gtab{\printnoteD{}\#m7}{~:XX1322}
\hspace{1cm} \hspace{1cm}
\gtab*{D\#7M}{3:022010} \gtab*{\printnoteD{}\#7M}{3:022010}
\gtab*{D\#4}{4:X21000} \gtab*{\printnoteD{}\#4}{4:X21000}
\gtab*{D\#7}{4:X2120X} \gtab*{\printnoteD{}\#7}{4:X2120X}
\gtab*{D\#6}{1:X00202} \gtab*{\printnoteD{}\#6}{1:X00202}
\chordrule \chordrule
\chordname{\chordnameE} \chordname{\chordnameE}
\gtab{E}{~:022100} \gtab{\printnoteE{}}{~:022100}
\gtab{E7}{~:020100} \gtab{\printnoteE{}7}{~:020100}
\gtab{Em}{~:022000} \gtab{\printnoteE{}m}{~:022000}
\gtab{Em7}{~:022030} \gtab{\printnoteE{}m7}{~:022030}
\hspace{1cm} \hspace{1cm}
\gtab*{E7M}{~:021100} \gtab*{\printnoteE{}7M}{~:021100}
\gtab*{E4}{~:02220} \gtab*{\printnoteE{}4}{~:02220}
\gtab*{E7}{5:X2120X} \gtab*{\printnoteE{}7}{5:X2120X}
\gtab*{E6}{~:022120} \gtab*{\printnoteE{}6}{~:022120}
\chordrule \chordrule
\chordname{\chordnameF} \chordname{\chordnameF}
\gtab{F}{1:022100} \gtab{\printnoteF{}}{1:022100}
\gtab{F7}{1:020100} \gtab{\printnoteF{}7}{1:020100}
\gtab{Fm}{1:022000} \gtab{\printnoteF{}m}{1:022000}
\gtab{Fm7}{1:020000} \gtab{\printnoteF{}m7}{1:020000}
\hspace{1cm} \hspace{1cm}
\gtab*{F7M}{~:XX3210} \gtab*{\printnoteF{}7M}{~:XX3210}
\gtab*{F4}{1:022200} \gtab*{\printnoteF{}4}{1:022200}
\gtab*{F7}{6:X2120X} \gtab*{\printnoteF{}7}{6:X2120X}
\gtab*{F6}{~:XX0211} \gtab*{\printnoteF{}6}{~:XX0211}
\chordrule \chordrule
\chordname{\chordnameFsharp} \chordname{\chordnameFsharp}
\gtab{F\#}{2:022100} \gtab{\printnoteF{}\#}{2:022100}
\gtab{F\#7}{2:020100} \gtab{\printnoteF{}\#7}{2:020100}
\gtab{F\#m}{2:022000} \gtab{\printnoteF{}\#m}{2:022000}
\gtab{F\#m7}{2:020000} \gtab{\printnoteF{}\#m7}{2:020000}
\hspace{1cm} \hspace{1cm}
\gtab*{F\#7M}{~:XX4321} \gtab*{\printnoteF{}\#7M}{~:XX4321}
\gtab*{F\#4}{2:022200} \gtab*{\printnoteF{}\#4}{2:022200}
\gtab*{F\#7}{7:X2120X} \gtab*{\printnoteF{}\#7}{7:X2120X}
\gtab*{F\#6}{~:XX1322} \gtab*{\printnoteF{}\#6}{~:XX1322}
\chordrule \chordrule
\chordname{\chordnameG} \chordname{\chordnameG}
\gtab{G}{~:320003} \gtab{\printnoteG{}}{~:320003}
\gtab{G7}{~:320001} \gtab{\printnoteG{}7}{~:320001}
\gtab{Gm}{3:022000} \gtab{\printnoteG{}m}{3:022000}
\gtab{Gm7}{3:020000} \gtab{\printnoteG{}m7}{3:020000}
\hspace{1cm} \hspace{1cm}
\gtab*{G7M}{~:XX0002} \gtab*{\printnoteG{}7M}{~:XX0002}
\gtab*{G4}{3:022200} \gtab*{\printnoteG{}4}{3:022200}
\gtab*{G7}{3:020200} \gtab*{\printnoteG{}7}{3:020200}
\gtab*{G6}{~:320000} \gtab*{\printnoteG{}6}{~:320000}
\chordrule \chordrule
\chordname{\chordnameGsharp} \chordname{\chordnameGsharp}
\gtab{G\#}{4:022100} \gtab{\printnoteG{}\#}{4:022100}
\gtab{G\#7}{4:020100} \gtab{\printnoteG{}\#7}{4:020100}
\gtab{G\#m}{4:022000} \gtab{\printnoteG{}\#m}{4:022000}
\gtab{G\#m7}{4:020000} \gtab{\printnoteG{}\#m7}{4:020000}
\hspace{1cm} \hspace{1cm}
\gtab*{G\#7M}{3:XX4321} \gtab*{\printnoteG{}\#7M}{3:XX4321}
\gtab*{G\#4}{4:022200} \gtab*{\printnoteG{}\#4}{4:022200}
\gtab*{G\#7}{~:XX1122} \gtab*{\printnoteG{}\#7}{~:XX1122}
\gtab*{G\#6}{~:XX1111} \gtab*{\printnoteG{}\#6}{~:XX1111}
\chordrule \chordrule
\chordname{\chordnameA} \chordname{\chordnameA}
\gtab{A}{~:X02220} \gtab{\printnoteA{}}{~:X02220}
\gtab{A7}{~:X02020} \gtab{\printnoteA{}7}{~:X02020}
\gtab{Am}{~:X02210} \gtab{\printnoteA{}m}{~:X02210}
\gtab{Am7}{~:X02213} \gtab{\printnoteA{}m7}{~:X02213}
\hspace{1cm} \hspace{1cm}
\gtab*{A7M}{~:X02120} \gtab*{\printnoteA{}7M}{~:X02120}
\gtab*{A4}{~:X02230} \gtab*{\printnoteA{}4}{~:X02230}
\gtab*{A7}{~:X02233} \gtab*{\printnoteA{}7}{~:X02233}
\gtab*{A6}{~:XX2222} \gtab*{\printnoteA{}6}{~:XX2222}
\chordrule \chordrule
\chordname{\chordnameAsharp} \chordname{\chordnameAsharp}
\gtab{A\#}{1:X02220} \gtab{\printnoteA{}\#}{1:X02220}
\gtab{A\#7}{1:X02020} \gtab{\printnoteA{}\#7}{1:X02020}
\gtab{A\#m}{1:X02210} \gtab{\printnoteA{}\#m}{1:X02210}
\gtab{A\#m7}{1:X02010} \gtab{\printnoteA{}\#m7}{1:X02010}
\hspace{1cm} \hspace{1cm}
\gtab*{A\#7M}{1:X02120} \gtab*{\printnoteA{}\#7M}{1:X02120}
\gtab*{A\#4}{1:X02230} \gtab*{\printnoteA{}\#4}{1:X02230}
\gtab*{A\#7}{~:XX3344} \gtab*{\printnoteA{}\#7}{~:XX3344}
\gtab*{A\#6}{~:XX3333} \gtab*{\printnoteA{}\#6}{~:XX3333}
\chordrule \chordrule
\chordname{\chordnameB} \chordname{\chordnameB}
\gtab{B}{2:X02220} \gtab{\printnoteB{}}{2:X02220}
\gtab{B7}{X21202} \gtab{\printnoteB{}7}{X21202}
\gtab{Bm}{2:X02210} \gtab{\printnoteB{}m}{2:X02210}
\gtab{Bm7}{~:X00202} \gtab{\printnoteB{}m7}{~:X00202}
\hspace{1cm} \hspace{1cm}
\gtab*{B7M}{2:X02120} \gtab*{\printnoteB{}7M}{2:X02120}
\gtab*{B4}{2:X02230} \gtab*{\printnoteB{}4}{2:X02230}
\gtab*{B7}{~:X22202} \gtab*{\printnoteB{}7}{~:X22202}
\gtab*{B6}{~:XX4444} \gtab*{\printnoteB{}6}{~:XX4444}
\begin{verse*} \begin{verse*}
\musicnote[french]{Accordage standard : {\nolyrics \[E A D G B E]}} \musicnote[french]{Accordage standard : {\nolyrics \[\printnoteE{} \printnoteA{} \printnoteD{} \printnoteG{} \printnoteB{} \printnoteE{}]}}
\musicnote[english]{Standard tuning: {\nolyrics \[E A D G B E]}} \musicnote[english]{Standard tuning: {\nolyrics \[\printnoteE{} \printnoteA{} \printnoteD{} \printnoteG{} \printnoteB{} \printnoteE{}]}}
\end{verse*} \end{verse*}
\endsong \endsong
@ -215,151 +199,151 @@
\beginsong{\ukulelechordsname} \beginsong{\ukulelechordsname}
\chordname{\chordnameC} \chordname{\chordnameC}
\utab{C}{~:0003} \utab{\printnoteC{}}{~:0003}
\utab{C7}{~:0001} \utab{\printnoteC{}7}{~:0001}
\utab{Cm}{~:0333} \utab{\printnoteC{}m}{~:0333}
\utab{Cm7}{3:0000} \utab{\printnoteC{}m7}{3:0000}
\hspace{1cm} \hspace{1cm}
\utab*{C7M}{~:0002} \utab*{\printnoteC{}7M}{~:0002}
\utab*{C6}{~:0000} \utab*{\printnoteC{}6}{~:0000}
\utab*{Caug}{~:1003} \utab*{\printnoteC{}aug}{~:1003}
\utab*{Cdim}{2:3101} \utab*{\printnoteC{}dim}{2:3101}
\chordrule \chordrule
\chordname{\chordnameCsharp} \chordname{\chordnameCsharp}
\utab{C\#}{1:0003} \utab{\printnoteC{}\#}{1:0003}
\utab{C\#7}{1:0001} \utab{\printnoteC{}\#7}{1:0001}
\utab{C\#m}{~:1104} \utab{\printnoteC{}\#m}{~:1104}
\utab{C\#m7}{4:0000} \utab{\printnoteC{}\#m7}{4:0000}
\hspace{1cm} \hspace{1cm}
\utab*{C\#7M}{1:0002} \utab*{\printnoteC{}\#7M}{1:0002}
\utab*{C\#6}{1:0000} \utab*{\printnoteC{}\#6}{1:0000}
\utab*{C\#aug}{~:2110} \utab*{\printnoteC{}\#aug}{~:2110}
\utab*{C\#dim}{~:0104} \utab*{\printnoteC{}\#dim}{~:0104}
\chordrule \chordrule
\chordname{\chordnameD} \chordname{\chordnameD}
\utab{D}{~:2220} \utab{\printnoteD{}}{~:2220}
\utab{D7}{2:0001} \utab{\printnoteD{}7}{2:0001}
\utab{Dm}{~:2210} \utab{\printnoteD{}m}{~:2210}
\utab{Dm7}{1:1102} \utab{\printnoteD{}m7}{1:1102}
\hspace{1cm} \hspace{1cm}
\utab*{D7M}{2:0002} \utab*{\printnoteD{}7M}{2:0002}
\utab*{D6}{2:0000} \utab*{\printnoteD{}6}{2:0000}
\utab*{Daug}{1:2110} \utab*{\printnoteD{}aug}{1:2110}
\utab*{Ddim}{1:0104} \utab*{\printnoteD{}dim}{1:0104}
\chordrule \chordrule
\chordname{\chordnameDsharp} \chordname{\chordnameDsharp}
\utab{D\#}{1:2220} \utab{\printnoteD{}\#}{1:2220}
\utab{D\#7}{3:0001} \utab{\printnoteD{}\#7}{3:0001}
\utab{D\#m}{1:2210} \utab{\printnoteD{}\#m}{1:2210}
\utab{D\#m7}{2:1102} \utab{\printnoteD{}\#m7}{2:1102}
\hspace{1cm} \hspace{1cm}
\utab*{D\#7M}{3:0002} \utab*{\printnoteD{}\#7M}{3:0002}
\utab*{D\#6}{3:0000} \utab*{\printnoteD{}\#6}{3:0000}
\utab*{D\#aug}{~:0332} \utab*{\printnoteD{}\#aug}{~:0332}
\utab*{D\#dim}{~:2320} \utab*{\printnoteD{}\#dim}{~:2320}
\chordrule \chordrule
\chordname{\chordnameE} \chordname{\chordnameE}
\utab{E}{2:2220} \utab{\printnoteE{}}{2:2220}
\utab{E7}{~:1202} \utab{\printnoteE{}7}{~:1202}
\utab{Em}{~:0432} \utab{\printnoteE{}m}{~:0432}
\utab{Em7}{~:0202} \utab{\printnoteE{}m7}{~:0202}
\hspace{1cm} \hspace{1cm}
\utab*{E7M}{~:1302} \utab*{\printnoteE{}7M}{~:1302}
\utab*{E6}{~:1102} \utab*{\printnoteE{}6}{~:1102}
\utab*{Eaug}{1:0000} \utab*{\printnoteE{}aug}{1:0000}
\utab*{Edim}{1:2320} \utab*{\printnoteE{}dim}{1:2320}
\chordrule \chordrule
\chordname{\chordnameF} \chordname{\chordnameF}
\utab{F}{~:2010} \utab{\printnoteF{}}{~:2010}
\utab{F7}{~:2310} \utab{\printnoteF{}7}{~:2310}
\utab{Fm}{~:1013} \utab{\printnoteF{}m}{~:1013}
\utab{Fm7}{1:0202} \utab{\printnoteF{}m7}{1:0202}
\hspace{1cm} \hspace{1cm}
\utab*{F7M}{1:1302} \utab*{\printnoteF{}7M}{1:1302}
\utab*{F6}{1:1102} \utab*{\printnoteF{}6}{1:1102}
\utab*{Faug}{~:2110} \utab*{\printnoteF{}aug}{~:2110}
\utab*{Fdim}{2:2320} \utab*{\printnoteF{}dim}{2:2320}
\chordrule \chordrule
\chordname{\chordnameFsharp} \chordname{\chordnameFsharp}
\utab{F\#}{1:2010} \utab{\printnoteF{}\#}{1:2010}
\utab{F\#7}{1:2310} \utab{\printnoteF{}\#7}{1:2310}
\utab{F\#m}{~:2120} \utab{\printnoteF{}\#m}{~:2120}
\utab{F\#m7}{2:0202} \utab{\printnoteF{}\#m7}{2:0202}
\hspace{1cm} \hspace{1cm}
\utab*{F\#7M}{2:1302} \utab*{\printnoteF{}\#7M}{2:1302}
\utab*{F\#6}{~:0202} \utab*{\printnoteF{}\#6}{~:0202}
\utab*{F\#aug}{1:2110} \utab*{\printnoteF{}\#aug}{1:2110}
\utab*{F\#dim}{~:2020} \utab*{\printnoteF{}\#dim}{~:2020}
\chordrule \chordrule
\chordname{\chordnameG} \chordname{\chordnameG}
\utab{G}{~:0232} \utab{\printnoteG{}}{~:0232}
\utab{G7}{~:0212} \utab{\printnoteG{}7}{~:0212}
\utab{Gm}{~:0231} \utab{\printnoteG{}m}{~:0231}
\utab{Gm7}{~:0211} \utab{\printnoteG{}m7}{~:0211}
\hspace{1cm} \hspace{1cm}
\utab*{G7M}{~:0222} \utab*{\printnoteG{}7M}{~:0222}
\utab*{G6}{~:0202} \utab*{\printnoteG{}6}{~:0202}
\utab*{Gaug}{~:0332} \utab*{\printnoteG{}aug}{~:0332}
\utab*{Gdim}{~:0131} \utab*{\printnoteG{}dim}{~:0131}
\chordrule \chordrule
\chordname{\chordnameGsharp} \chordname{\chordnameGsharp}
\utab{G\#}{3:2010} \utab{\printnoteG{}\#}{3:2010}
\utab{G\#7}{1:0212} \utab{\printnoteG{}\#7}{1:0212}
\utab{G\#m}{1:0231} \utab{\printnoteG{}\#m}{1:0231}
\utab{G\#m7}{1:0211} \utab{\printnoteG{}\#m7}{1:0211}
\hspace{1cm} \hspace{1cm}
\utab*{G\#7M}{1:0222} \utab*{\printnoteG{}\#7M}{1:0222}
\utab*{G\#6}{1:0202} \utab*{\printnoteG{}\#6}{1:0202}
\utab*{G\#aug}{~:1003} \utab*{\printnoteG{}\#aug}{~:1003}
\utab*{G\#dim}{1:0131} \utab*{\printnoteG{}\#dim}{1:0131}
\chordrule \chordrule
\chordname{\chordnameA} \chordname{\chordnameA}
\utab{A}{~:2100} \utab{\printnoteA{}}{~:2100}
\utab{A7}{~:0100} \utab{\printnoteA{}7}{~:0100}
\utab{Am}{~:2000} \utab{\printnoteA{}m}{~:2000}
\utab{Am7}{~:0000} \utab{\printnoteA{}m7}{~:0000}
\hspace{1cm} \hspace{1cm}
\utab*{A7M}{~:1100} \utab*{\printnoteA{}7M}{~:1100}
\utab*{A6}{2:0202} \utab*{\printnoteA{}6}{2:0202}
\utab*{Aaug}{~:2110} \utab*{\printnoteA{}aug}{~:2110}
\utab*{Adim}{2:0131} \utab*{\printnoteA{}dim}{2:0131}
\chordrule \chordrule
\chordname{\chordnameAsharp} \chordname{\chordnameAsharp}
\utab{A\#}{1:2100} \utab{\printnoteA{}\#}{1:2100}
\utab{A\#7}{1:0100} \utab{\printnoteA{}\#7}{1:0100}
\utab{A\#m}{1:2000} \utab{\printnoteA{}\#m}{1:2000}
\utab{A\#m7}{1:0000} \utab{\printnoteA{}\#m7}{1:0000}
\hspace{1cm} \hspace{1cm}
\utab*{A\#7M}{1:1100} \utab*{\printnoteA{}\#7M}{1:1100}
\utab*{A\#6}{~:0211} \utab*{\printnoteA{}\#6}{~:0211}
\utab*{A\#aug}{1:2110} \utab*{\printnoteA{}\#aug}{1:2110}
\utab*{A\#dim}{~:3101} \utab*{\printnoteA{}\#dim}{~:3101}
\chordrule \chordrule
\chordname{\chordnameB} \chordname{\chordnameB}
\utab{B}{2:2100} \utab{\printnoteB{}}{2:2100}
\utab{B7}{2:0100} \utab{\printnoteB{}7}{2:0100}
\utab{Bm}{2:2000} \utab{\printnoteB{}m}{2:2000}
\utab{Bm7}{2:0000} \utab{\printnoteB{}m7}{2:0000}
\hspace{1cm} \hspace{1cm}
\utab*{B7M}{2:1100} \utab*{\printnoteB{}7M}{2:1100}
\utab*{B6}{1:0211} \utab*{\printnoteB{}6}{1:0211}
\utab*{Baug}{~:0332} \utab*{\printnoteB{}aug}{~:0332}
\utab*{Bdim}{1:3101} \utab*{\printnoteB{}dim}{1:3101}
\begin{verse*} \begin{verse*}
\musicnote[french]{Accordage standard : {\nolyrics \[G C E A]}} \musicnote[french]{Accordage standard : {\nolyrics \[\printnoteG{} \printnoteC{} \printnoteE{} \printnoteA{}]}}
\musicnote[english]{Standard tuning: {\nolyrics \[G C E A]}} \musicnote[english]{Standard tuning: {\nolyrics \[\printnoteG{} \printnoteC{} \printnoteE{} \printnoteA{}]}}
\end{verse*} \end{verse*}
\endsong \endsong

30
songbook_core/data/latex/venturisold.sty

@ -1,30 +0,0 @@
%% Copyright 2010 Clea F. Rees
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Clea F. Rees.
%
% This work consists of all files listed in manifest.txt.
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{venturisold}[2010/07/03 v1.005 VenturisOldADF PS]
\RequirePackage[T1]{fontenc}
\RequirePackage{textcomp}
\RequirePackage{nfssext-cfr}
%:Make Venturis Old default for roman text
\renewcommand{\rmdefault}{yvo}
%:introduce special titling commands
\DeclareRobustCommand{\vtstyle}[1][]{% allow an optional argument for consistency with venturis.sty
\not@math@alphabet\vtstyle\relax
\fontfamily{yvod}\selectfont}
\DeclareTextFontCommand{\textvt}{\vtstyle}
\DeclareTextFontCommand{\textvtl}{\vtstyle}
\endinput
%% end venturisold.sty

1168
songbook_core/data/latex/xstring.sty

File diff suppressed because it is too large

16
songbook_core/data/templates/default.tex

@ -58,7 +58,11 @@
"authwords": {"description": {"english": "Set of options to process author string (LaTeX commands authsepword, authignoreword, authbyword)", "authwords": {"description": {"english": "Set of options to process author string (LaTeX commands authsepword, authignoreword, authbyword)",
"french": "Options pour traiter les noms d'auteurs (commandes LaTeX authsepword, authignoreword, authbyword)"}, "french": "Options pour traiter les noms d'auteurs (commandes LaTeX authsepword, authignoreword, authbyword)"},
"default": {"default": {}} "default": {"default": {}}
} },
"notenamesout": {"description": {"english": "Note names. Can be 'solfedge' (Do, Re, Mi...) or 'alphascale' (A, B, C...).",
"french": "Nom des notes : 'solfedge' (Do, Ré, Mi...) ou 'alphascale' (A, B, C...)."},
"default": {"default": "alphascale", "french": "solfedge"}
}
} }
(* endvariables *) (* endvariables *)
@ -97,6 +101,12 @@
(* endif *) (* endif *)
(* endfor *) (* endfor *)
(* endfor*) (* endfor*)
(* if notenamesout=="alphascale" *)
\notenamesout{A}{B}{C}{D}{E}{F}{G}
(* else *)
\notenamesout{La}{Si}{Do}{R\'e}{Mi}{Fa}{Sol}
(* endif *)
(* endblock *) (* endblock *)
(* block title *) (* block title *)
@ -106,10 +116,6 @@
(* block index *) (* block index *)
\showindex{\songindexname}{titleidx} \showindex{\songindexname}{titleidx}
\showindex{\authorindexname}{authidx} \showindex{\authorindexname}{authidx}
(* if lang==french *)
\notenamesin{A}{B}{C}{D}{E}{F}{G}
\notenamesout{La}{Si}{Do}{}{Mi}{Fa}{Sol}
(* endif *)
(* endblock *) (* endblock *)
(* block chords *) (* block chords *)

2
songbook_core/data/templates/layout.tex

@ -19,7 +19,7 @@
%! https://github.com/patacrep/ %! https://github.com/patacrep/
%% Automaticly generated document. %% Automatically generated document.
%% You may edit this file but all changes will be overwritten. %% You may edit this file but all changes will be overwritten.
%% If you want to change this document, have a look at %% If you want to change this document, have a look at
%% the templating system. %% the templating system.

27
songbook_core/index.py

@ -11,11 +11,12 @@ from a file generated by the latex compilation of the songbook (.sxd).
from unidecode import unidecode from unidecode import unidecode
import locale import locale
import re import re
import codecs
from songbook_core.authors import processauthors from songbook_core.authors import processauthors
from songbook_core.plastex import simpleparse from songbook_core.plastex import simpleparse
EOL = "\n" EOL = u"\n"
# Pattern set to ignore latex command in title prefix # Pattern set to ignore latex command in title prefix
KEYWORD_PATTERN = re.compile(r"^%(\w+)\s?(.*)$") KEYWORD_PATTERN = re.compile(r"^%(\w+)\s?(.*)$")
@ -37,11 +38,10 @@ def process_sxd(filename):
Return an Index object. Return an Index object.
""" """
index_file = open(filename)
data = [] data = []
for line in index_file: with codecs.open(filename, 'r', 'utf-8') as index_file:
data.append(line.strip()) for line in index_file:
index_file.close() data.append(line.strip())
i = 1 i = 1
idx = Index(data[0]) idx = Index(data[0])
@ -124,7 +124,7 @@ class Index(object):
def _raw_add(self, key, number, link): def _raw_add(self, key, number, link):
"""Add a song to the list. """Add a song to the list.
No processing is done one data. It is added raw. See add() for a No processing is done on data. It is added raw. See add() for a
similar method with processing. similar method with processing.
""" """
first = self.get_first_letter(key) first = self.get_first_letter(key)
@ -142,13 +142,16 @@ class Index(object):
if self.indextype == "TITLE": if self.indextype == "TITLE":
# Removing prefixes before titles # Removing prefixes before titles
for pattern in self.prefix_patterns: for pattern in self.prefix_patterns:
match = pattern.match(key) match = pattern.match(key.encode('utf-8'))
if match: if match:
self._raw_add( self._raw_add(
"{} ({})".format( "{} ({})".format(
match.group(2) + match.group(3), match.group(2) + match.group(3),
match.group(1)), match.group(1)
number, link) ),
number,
link
)
return return
self._raw_add(key, number, link) self._raw_add(key, number, link)
@ -166,9 +169,11 @@ class Index(object):
def entry_to_str(self, key, entry): def entry_to_str(self, key, entry):
"""Return the LaTeX code corresponding to the entry.""" """Return the LaTeX code corresponding to the entry."""
return unicode(r'\idxentry{{{0}}}{{{1}}}' + EOL).format( if not isinstance(key, unicode):
key = unicode(key, "UTF-8")
return unicode(ur'\idxentry{{{0}}}{{{1}}}' + EOL).format(
key, key,
r'\\'.join([self.ref_to_str(ref) for ref in entry]), ur'\\'.join([self.ref_to_str(ref) for ref in entry]),
) )
def idxblock_to_str(self, letter, entries): def idxblock_to_str(self, letter, entries):

5
songbook_core/plastex.py

@ -38,7 +38,9 @@ def simpleparse(text):
"""Parse a simple LaTeX string. """Parse a simple LaTeX string.
""" """
tex = TeX() tex = TeX()
tex.input(text.decode('utf8')) if not isinstance(text, unicode):
text = text.decode("utf-8")
tex.input(text)
doc = tex.parse() doc = tex.parse()
return process_unbr_spaces(doc.textContent) return process_unbr_spaces(doc.textContent)
@ -57,6 +59,7 @@ class SongParser(object):
tex.ownerDocument.context.loadBaseMacros() tex.ownerDocument.context.loadBaseMacros()
sys.path.append(os.path.dirname(__file__)) sys.path.append(os.path.dirname(__file__))
tex.ownerDocument.context.loadPackage(tex, "plastex_patchedbabel") tex.ownerDocument.context.loadPackage(tex, "plastex_patchedbabel")
tex.ownerDocument.context.loadPackage(tex, "plastex_chord")
tex.ownerDocument.context.loadPackage(tex, "plastex_songs") tex.ownerDocument.context.loadPackage(tex, "plastex_songs")
sys.path.pop() sys.path.pop()
return tex return tex

110
songbook_core/plastex_chord.py

@ -0,0 +1,110 @@
# -*- coding: utf-8 -*-
r"""PlasTeX module to deal with chords commands of the songs LaTeX package
Chords are set using commands like \[C]. This package parses those commands.
"""
from plasTeX import Command, Environment, Macro
from plasTeX.Base.LaTeX.Math import BeginDisplayMath
# Count the number of levels of 'verse' environment: IN_VERSE==1 means that we
# are in a 'verse' environment; IN_VERSE==2 means that we are in two included
# 'verse' environment, and so on.
IN_VERSE = 0
def wrap_displaymath(cls):
"""Decorator to store the depth of 'verse' environment
In the invoke() method classes, global variable IN_VERSE indicates the
number of 'verse' (or 'chorus' or 'verse*') environment we are in.
"""
# pylint: disable=no-init,too-few-public-methods
class DisplayMath(cls):
"""Wrapper to LaTeX environment updating IN_VERSE"""
blockType = True
# pylint: disable=super-on-old-class,global-statement,no-member
def invoke(self, tex):
"""Wrapper to invoke() to update global variable IN_VERSE."""
global IN_VERSE
if self.macroMode == Macro.MODE_BEGIN:
IN_VERSE += 1
else:
IN_VERSE -= 1
super(DisplayMath, self).invoke(tex)
return DisplayMath
# pylint: disable=too-many-public-methods
@wrap_displaymath
class Verse(Environment):
"""LaTeX 'verse' environment"""
macroName = 'verse'
# pylint: disable=too-many-public-methods
@wrap_displaymath
class VerseStar(Environment):
"""LaTeX 'verse*' environment"""
macroName = 'verse*'
# pylint: disable=too-many-public-methods
@wrap_displaymath
class Chorus(Environment):
"""LaTeX 'chorus' environment"""
macroName = 'chorus'
class BeginChord(Command):
"""Beginning of a chord notation"""
macroName = 'chord'
macroMode = Command.MODE_BEGIN
@property
def source(self):
"""Return chord LaTeX code."""
return r'\[{}]'.format(''.join([str(item) for item in self.childNodes]))
class EndChord(Command):
"""End of a chord notation"""
macroMode = Command.MODE_END
class BeginChordOrDisplayMath(BeginDisplayMath):
r"""Wrapper to BeginDisplayMath
In a 'verse' (or 'verse*' or 'chorus') environment, the '\[' macro
displays a chord. Otherwise, it corresponds to the usual LaTeX math mode.
This class calls the right method, depending on the inclusion of this
macro in a verse environment.
"""
macroName = '['
def digest(self, tokens):
"""Consume the tokens corresponding to the arguments of this macro"""
if IN_VERSE:
for item in tokens:
if item.nodeType == item.TEXT_NODE and item.nodeValue == ']':
break
self.appendChild(item)
else:
return super(BeginChordOrDisplayMath, self).digest(tokens)
def invoke(self, tex):
"""Process this macro"""
if IN_VERSE:
begin = BeginChord()
self.ownerDocument.context.push(begin) # pylint: disable=no-member
self.parse(tex)
for token in tex:
if token.nodeType == token.TEXT_NODE and token.nodeValue == ']':
break
else:
begin.appendChild(token)
end = EndChord()
self.ownerDocument.context.push(end) # pylint: disable=no-member
return [begin]
else:
return super(BeginChordOrDisplayMath, self).invoke(tex)

6
stdeb.cfg

@ -0,0 +1,6 @@
[DEFAULT]
Depends: python-jinja2, python-pkg-resources, python-plastex, python-unidecode, texlive-latex-base, texlive-latex-recommended, texlive-latex-extra, lilypond, texlive-fonts-recommended
Recommends: texlive-lang-english, texlive-lang-french, texlive-lang-portuguese, texlive-lang-spanish, texlive-fonts-extra
XS-Python-Version: >=2.7
Section: tex
Loading…
Cancel
Save