From be74e4ab97879c653246db714b956fc912051c72 Mon Sep 17 00:00:00 2001 From: Olivier Radisson Date: Tue, 13 Oct 2020 03:29:08 +0200 Subject: [PATCH 1/2] Allow user to define exact order of document section --- patacrep/data/templates/songbook/layout.tex | 56 ++++++++++++++++----- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/patacrep/data/templates/songbook/layout.tex b/patacrep/data/templates/songbook/layout.tex index 19817749..1355e9de 100644 --- a/patacrep/data/templates/songbook/layout.tex +++ b/patacrep/data/templates/songbook/layout.tex @@ -25,6 +25,31 @@ %% %% Generated using Songbook +(* variables *) +schema: + type: //rec + optional: + display: + type: //arr + contents: //str +default: + en: + display: + - "Title" + - "Preface" + - "Index" + - "Chords" + - "Songs" + - "Postface" +description: + en: + display: "Ordinate list of section to display" + fr: + display: "Liste ordonnée des sections à afficher" +(* endvariables -*) + +(*- set layout_var = _template["layout.tex"] -*) + \makeatletter \def\input@path{ % (* for dir in _datadir|iter_datadirs *) @@ -47,25 +72,30 @@ (* block preambule *) (* endblock preambule *) -\begin{document} - +\gdef\LayoutTitle{% (* block title *) -(* endblock *) - +(* endblock *)} +\gdef\LayoutPreface{% (* block preface *) -(* endblock *) - +(* endblock *)} +\gdef\LayoutIndex{% (* block index *) -(* endblock *) - +(* endblock *)} +\gdef\LayoutChords{% (* block chords *) -(* endblock *) - +(* endblock *)} +\gdef\LayoutSongs{% (* block songs *) -(* endblock *) - +(* endblock *)} +\gdef\LayoutPostface{% (* block postface *) -(* endblock *) +(* endblock *)} + +\begin{document} + +(* for block in layout_var.display *) +\Layout(( block )) +(* endfor *) \end{document} From 4150d10d258ecf74034f59f9a552525f02f21852 Mon Sep 17 00:00:00 2001 From: Olivier Radisson Date: Tue, 13 Oct 2020 15:01:56 +0200 Subject: [PATCH 2/2] Use a more precise definition for 'display' config in layout.tex --- patacrep/data/templates/songbook/layout.tex | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/patacrep/data/templates/songbook/layout.tex b/patacrep/data/templates/songbook/layout.tex index 1355e9de..c8f2674f 100644 --- a/patacrep/data/templates/songbook/layout.tex +++ b/patacrep/data/templates/songbook/layout.tex @@ -31,7 +31,21 @@ schema: optional: display: type: //arr - contents: //str + contents: + type: //any + of: + - type: //str + value: "Title" + - type: //str + value: "Preface" + - type: //str + value: "Index" + - type: //str + value: "Chords" + - type: //str + value: "Songs" + - type: //str + value: "Postface" default: en: display: @@ -43,7 +57,7 @@ default: - "Postface" description: en: - display: "Ordinate list of section to display" + display: "Ordered list of section to display" fr: display: "Liste ordonnée des sections à afficher" (* endvariables -*)