Browse Source

Chord names must be given as an array (instead of a space separated

list)
pull/217/head
Louis 9 years ago
parent
commit
f8e9931670
  1. 27
      patacrep/build.py
  2. 16
      patacrep/data/templates/songbook_model.yml

27
patacrep/build.py

@ -29,16 +29,6 @@ GENERATED_EXTENSIONS = [
"_title.sxd",
]
class BookError(errors.SharedError):
"""Global book error."""
def __init__(self, message):
super().__init__()
self.message = message
def __str__(self):
return self.message
# pylint: disable=too-few-public-methods
class Songbook:
"""Represent a songbook (.yaml) file.
@ -129,22 +119,7 @@ class Songbook:
return ["A", "B", "C", "D", "E", "F", "G"]
if notation == "solfedge":
return ["La", "Si", "Do", r"R\'e", "Mi", "Fa", "Sol"]
names = notation.split(" ")
if len(names) == 7:
return names
error = BookError(
"Option `notation` of section `chords` must be `solfedge`, "
"`alphascale` or a space separated list of exactly seven note "
"names."
)
self._errors.append(error)
LOGGER.warning(str(error))
if len(names) < 7:
return names + ["?"] * (7-len(names))
else:
return names[:7]
return notation
def has_errors(self):
"""Return `True` iff errors have been encountered in the book.

16
patacrep/data/templates/songbook_model.yml

@ -56,7 +56,17 @@ schema:
- type: //str
value: "ukulele"
notation:
type: //str
type: //any
of:
- type: //str
value: "alphascale"
- type: //str
value: "solfedge"
- type: //arr
contents: //str
length:
min: 7
max: 7
authors:
type: //rec
required:
@ -152,7 +162,7 @@ description:
lilypond: "Display lilypond scores"
tablatures: "Display tablatures"
instrument: "Instrument for the diagrams"
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`."
notation: "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:
separators: "Separator words between artists"
@ -178,7 +188,7 @@ description:
lilypond: "Inclure les partitions lilypond"
tablatures: "Inclure les tablatures"
instrument: "Instrument pour les diagrammes d'accords"
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`."
notation: "Liste des noms de notes, 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:
separators: "Mots de séparation entre les artistes"

Loading…
Cancel
Save