From 890abc59db62660d2d6d244a1dba0ab2f3302733 Mon Sep 17 00:00:00 2001 From: Olivier Radisson Date: Tue, 13 Oct 2020 14:51:35 +0200 Subject: [PATCH] Use a more elegant syntax to select diagrampages --- patacrep/data/templates/songbook_model.yml | 10 ++++++++-- patacrep/templates.py | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/patacrep/data/templates/songbook_model.yml b/patacrep/data/templates/songbook_model.yml index bc73ab99..846d0701 100644 --- a/patacrep/data/templates/songbook_model.yml +++ b/patacrep/data/templates/songbook_model.yml @@ -55,8 +55,14 @@ schema: value: "guitar" - type: //str value: "ukulele" - - type: //str - value: "guitar+ukulele" + - type: //arr + contents: + type: //any + of: + - type: //str + value: "guitar" + - type: //str + value: "ukulele" notation: type: //any of: diff --git a/patacrep/templates.py b/patacrep/templates.py index d7167920..77ae5fc8 100644 --- a/patacrep/templates.py +++ b/patacrep/templates.py @@ -325,5 +325,7 @@ def iter_bookoptions(config): elif config['chords']['diagrampage'] == "all": yield 'diagrampage' - for instrument in config['chords']['instrument'].split("+"): - yield instrument + if isinstance(config['chords']['instrument'], str): + yield config['chords']['instrument'] + else: + yield from config['chords']['instrument']