From 79be2a56ec7595e820508f11669efe6e0671e757 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 10 Mar 2016 20:52:53 +0100 Subject: [PATCH 1/2] Allow finer tuning of the diagram page: all/important/none --- patacrep/data/templates/songbook/default.tex | 11 +++++------ patacrep/data/templates/songbook_model.yml | 12 ++++++++++-- patacrep/data/templates/styles/chords.sty | 13 ++++++++++++- patacrep/data/templates/styles/patacrep.sty | 8 ++++++++ patacrep/templates.py | 5 +++++ test/test_songbook/content.tex.control | 12 ++++++------ test/test_songbook/datadir.tex.control | 12 ++++++------ test/test_songbook/lang_default.tex.control | 12 ++++++------ test/test_songbook/lang_en.tex.control | 12 ++++++------ test/test_songbook/lang_fr.tex.control | 12 ++++++------ test/test_songbook/languages.tex.control | 12 ++++++------ .../onthefly/content.onthefly.tex.control | 12 ++++++------ test/test_songbook/syntax.tex.control | 12 ++++++------ test/test_songbook/unicode.tex.control | 12 ++++++------ 14 files changed, 94 insertions(+), 63 deletions(-) diff --git a/patacrep/data/templates/songbook/default.tex b/patacrep/data/templates/songbook/default.tex index 52d759b9..5eef827a 100644 --- a/patacrep/data/templates/songbook/default.tex +++ b/patacrep/data/templates/songbook/default.tex @@ -103,12 +103,11 @@ description: (* block chords *) % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% (* endblock *) diff --git a/patacrep/data/templates/songbook_model.yml b/patacrep/data/templates/songbook_model.yml index 05c40f2b..a3d3ce1b 100644 --- a/patacrep/data/templates/songbook_model.yml +++ b/patacrep/data/templates/songbook_model.yml @@ -27,7 +27,15 @@ schema: type: //rec required: show: //bool - diagrampage: //bool + diagrampage: + type: //any + of: + - type: //str + value: "none" + - type: //str + value: "important" + - type: //str + value: "all" repeatchords: //bool lilypond: //bool tablatures: //bool @@ -97,7 +105,7 @@ default: chords: show: yes diagramreminder: important - diagrampage: yes + diagrampage: all repeatchords: yes lilypond: no tablatures: no diff --git a/patacrep/data/templates/styles/chords.sty b/patacrep/data/templates/styles/chords.sty index 236606e7..5f498e69 100644 --- a/patacrep/data/templates/styles/chords.sty +++ b/patacrep/data/templates/styles/chords.sty @@ -24,7 +24,7 @@ \raisebox{2em}{\chordname{##1}} % } % % Placing boxes - \ifimportantdiagramonly% + \ifdiagrampagereduced% \pl@cechord{#1}% \hspace{\stretch{1}}% \usebox{\@chordgroupbox@ii}% @@ -75,7 +75,17 @@ \newcommand{\chords}{ + \ifdiagrampage \begin{songs}{} + %important diagrams are hidden by \chordtabs + \renewcommand{\gtab}{\@ifstar + \gtab@Original% + \gtab@Original% + } + \renewcommand{\utab}{\@ifstar + \utab@Original% + \utab@Original% + } %hide song number \definecolor{SongNumberBgColor}{HTML}{FFFFFF} \renewcommand{\snumbgcolor}{SongNumberBgColor} @@ -391,5 +401,6 @@ \fi \end{songs} + \fi } \endinput diff --git a/patacrep/data/templates/styles/patacrep.sty b/patacrep/data/templates/styles/patacrep.sty index 5ed071c2..36e117fd 100644 --- a/patacrep/data/templates/styles/patacrep.sty +++ b/patacrep/data/templates/styles/patacrep.sty @@ -26,6 +26,14 @@ \newif{\iflilypondauto} \DeclareOption{lilypond}{\lilypondautotrue\lilypondtrue} +% diagram: display chord page before the songs +\newif{\ifdiagrampage} +\DeclareOption{diagrampage}{\diagrampagetrue} + +% diagram: display chord page before the songs +\newif{\ifdiagrampagereduced} +\DeclareOption{diagrampagereduced}{\diagrampagereducedtrue\diagrampagetrue} + % diagram: display chord diagrams at the beginning \newif{\ifdiagram} \DeclareOption{diagram}{\diagramtrue} diff --git a/patacrep/templates.py b/patacrep/templates.py index ca6740a1..c18ef454 100644 --- a/patacrep/templates.py +++ b/patacrep/templates.py @@ -296,4 +296,9 @@ def iter_bookoptions(config): elif config['chords']['diagramreminder'] == "all": yield 'diagram' + if config['chords']['diagrampage'] == "important": + yield 'diagrampagereduced' + elif config['chords']['diagrampage'] == "all": + yield 'diagrampage' + yield config['chords']['instrument'] diff --git a/test/test_songbook/content.tex.control b/test/test_songbook/content.tex.control index 9fd7d242..38a79074 100644 --- a/test/test_songbook/content.tex.control +++ b/test/test_songbook/content.tex.control @@ -26,6 +26,7 @@ chorded, pictures, diagram, +diagrampage, guitar, ]{patacrep} @@ -79,13 +80,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/datadir.tex.control b/test/test_songbook/datadir.tex.control index 1154a6fd..687a6096 100644 --- a/test/test_songbook/datadir.tex.control +++ b/test/test_songbook/datadir.tex.control @@ -28,6 +28,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{patacrep} @@ -82,13 +83,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/lang_default.tex.control b/test/test_songbook/lang_default.tex.control index 42f1e087..40391656 100644 --- a/test/test_songbook/lang_default.tex.control +++ b/test/test_songbook/lang_default.tex.control @@ -26,6 +26,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{crepbook} @@ -113,13 +114,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/lang_en.tex.control b/test/test_songbook/lang_en.tex.control index 11a9f401..55573ddd 100644 --- a/test/test_songbook/lang_en.tex.control +++ b/test/test_songbook/lang_en.tex.control @@ -26,6 +26,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{crepbook} @@ -113,13 +114,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/lang_fr.tex.control b/test/test_songbook/lang_fr.tex.control index 1255dcce..aca45a48 100644 --- a/test/test_songbook/lang_fr.tex.control +++ b/test/test_songbook/lang_fr.tex.control @@ -26,6 +26,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{crepbook} @@ -113,13 +114,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/languages.tex.control b/test/test_songbook/languages.tex.control index 46d888dc..a1cfa123 100644 --- a/test/test_songbook/languages.tex.control +++ b/test/test_songbook/languages.tex.control @@ -27,6 +27,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{patacrep} @@ -82,13 +83,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/onthefly/content.onthefly.tex.control b/test/test_songbook/onthefly/content.onthefly.tex.control index 8a882c85..3ee52e2e 100644 --- a/test/test_songbook/onthefly/content.onthefly.tex.control +++ b/test/test_songbook/onthefly/content.onthefly.tex.control @@ -25,6 +25,7 @@ chorded, pictures, diagram, +diagrampage, guitar, ]{patacrep} @@ -77,13 +78,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/syntax.tex.control b/test/test_songbook/syntax.tex.control index 1c925801..af7acb06 100644 --- a/test/test_songbook/syntax.tex.control +++ b/test/test_songbook/syntax.tex.control @@ -27,6 +27,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{patacrep} @@ -79,13 +80,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} diff --git a/test/test_songbook/unicode.tex.control b/test/test_songbook/unicode.tex.control index 7d088978..38ce6118 100644 --- a/test/test_songbook/unicode.tex.control +++ b/test/test_songbook/unicode.tex.control @@ -27,6 +27,7 @@ chorded, pictures, repeatchords, importantdiagramonly, +diagrampage, guitar, ]{patacrep} @@ -79,13 +80,12 @@ guitar, \showindex{\authorindexname}{authidx} % list of chords -\ifchorded - \ifdiagram - \phantomsection - \addcontentsline{toc}{section}{\chordlistname} - \chords - \fi +\ifdiagrampage + \phantomsection + \addcontentsline{toc}{section}{\chordlistname} + \chords \fi +\setcounter{songnum}{1}% \phantomsection \addcontentsline{toc}{section}{\songlistname} From 5e167214092f770949af40629c29a8f859658275 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 10 Mar 2016 21:04:44 +0100 Subject: [PATCH 2/2] correct comment --- patacrep/data/templates/styles/patacrep.sty | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patacrep/data/templates/styles/patacrep.sty b/patacrep/data/templates/styles/patacrep.sty index 36e117fd..8b88af75 100644 --- a/patacrep/data/templates/styles/patacrep.sty +++ b/patacrep/data/templates/styles/patacrep.sty @@ -26,11 +26,11 @@ \newif{\iflilypondauto} \DeclareOption{lilypond}{\lilypondautotrue\lilypondtrue} -% diagram: display chord page before the songs +% diagram: insert a page of diagrams before the songs \newif{\ifdiagrampage} \DeclareOption{diagrampage}{\diagrampagetrue} -% diagram: display chord page before the songs +% diagram: insert a page of the "important diagrams" before the songs \newif{\ifdiagrampagereduced} \DeclareOption{diagrampagereduced}{\diagrampagereducedtrue\diagrampagetrue}