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..8b88af75 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: insert a page of diagrams before the songs +\newif{\ifdiagrampage} +\DeclareOption{diagrampage}{\diagrampagetrue} + +% diagram: insert a page of the "important diagrams" 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}