Browse Source

Do not split definition of chord notation between python module and template

pull/217/head
Louis 9 years ago
parent
commit
c1e8ac80ed
  1. 14
      patacrep/build.py
  2. 6
      patacrep/data/templates/songbook/default.tex
  3. 4
      patacrep/data/templates/songbook_model.yml

14
patacrep/build.py

@ -111,7 +111,7 @@ class Songbook:
# Processing special options # Processing special options
self._config['_bookoptions'] = iter_bookoptions(self._config) self._config['_bookoptions'] = iter_bookoptions(self._config)
self._config['chords']['_notenames'] = self._process_chord_notation( self._config['chords']['_notenames'] = self._get_chord_names(
self._config['chords']['notation'] self._config['chords']['notation']
) )
@ -123,13 +123,17 @@ class Songbook:
if self.has_errors(): if self.has_errors():
raise errors.SongbookError("Some songs contain errors. Stopping as requested.") raise errors.SongbookError("Some songs contain errors. Stopping as requested.")
def _process_chord_notation(self, notation): def _get_chord_names(self, notation):
notation = notation.strip() """Return a list of chord names, given the user option."""
if notation in ['solfedge', 'alphascale']: if notation == "alphascale":
return notation return ["A", "B", "C", "D", "E", "F", "G"]
if notation == "solfedge":
return ["La", "Si", "Do", r"R\'e", "Mi", "Fa", "Sol"]
names = notation.split(" ") names = notation.split(" ")
if len(names) == 7: if len(names) == 7:
return names return names
error = BookError( error = BookError(
"Option `notation` of section `chords` must be `solfedge`, " "Option `notation` of section `chords` must be `solfedge`, "
"`alphascale` or a space separated list of exactly seven note " "`alphascale` or a space separated list of exactly seven note "

6
patacrep/data/templates/songbook/default.tex

@ -85,13 +85,7 @@ description:
\authsepword{((word))} \authsepword{((word))}
(* endfor *) (* endfor *)
(* if chords._notenames == "alphascale" -*)
\notenamesout{A}{B}{C}{D}{E}{F}{G}
(* elif chords._notenames == "solfedge" -*)
\notenamesout{La}{Si}{Do}{R\'e}{Mi}{Fa}{Sol}
(* else -*)
\notenamesout{(( chords._notenames[0] ))}{(( chords._notenames[1] ))}{(( chords._notenames[2] ))}{(( chords._notenames[3] ))}{(( chords._notenames[4] ))}{(( chords._notenames[5] ))}{(( chords._notenames[6] ))} \notenamesout{(( chords._notenames[0] ))}{(( chords._notenames[1] ))}{(( chords._notenames[2] ))}{(( chords._notenames[3] ))}{(( chords._notenames[4] ))}{(( chords._notenames[5] ))}{(( chords._notenames[6] ))}
(* endif *)
(* endblock *) (* endblock *)
(* block title *) (* block title *)

4
patacrep/data/templates/songbook_model.yml

@ -152,7 +152,7 @@ description:
lilypond: "Display lilypond scores" lilypond: "Display lilypond scores"
tablatures: "Display tablatures" tablatures: "Display tablatures"
instrument: "Instrument for the diagrams" instrument: "Instrument for the diagrams"
notation: "Chord notation. Can be `solfedge`, `alphascale`, or a space separated list of note names." notation: "Space separated list of chord names, with special values `solfedge` being an alias for `La Si Do Ré Mi Fa Sol`, and `alphascale` for `A B C D E F G`."
authors: authors:
separators: "Separator words between artists" separators: "Separator words between artists"
@ -178,7 +178,7 @@ description:
lilypond: "Inclure les partitions lilypond" lilypond: "Inclure les partitions lilypond"
tablatures: "Inclure les tablatures" tablatures: "Inclure les tablatures"
instrument: "Instrument pour les diagrammes d'accords" instrument: "Instrument pour les diagrammes d'accords"
notation: "Notation des accords. Peut être `solfedge` (DO RE MI...), `alphascale` (A B C...), ou une liste des noms de notes séparés par des espaces, en commençant par LA." notation: "Liste des noms de notes, séparés par des espaces, en commençant par LA, sachant que `solfedge` est un alias pour `La Si Do Ré Mi Fa Sol`, et `alphascale` pour `A B C D E F G`."
authors: authors:
separators: "Mots de séparation entre les artistes" separators: "Mots de séparation entre les artistes"

Loading…
Cancel
Save