introduce TEXT_PAGES

This commit is contained in:
tux 2025-05-19 22:14:08 +02:00
parent c47ceb443e
commit 8d0ddcee06
3 changed files with 43 additions and 6 deletions

View File

@ -34,7 +34,8 @@
LAYOUT = \layout { \generalLayout }
HEADER = {}
MUSIC = {}
TEXT = \markuplist {""}
TEXT = \markuplist {}
TEXT_PAGES = #f
verseChords = {}
firstVoice = {}

View File

@ -114,7 +114,7 @@ width may require additional tweaking.)"
includeSong =
#(define-void-function (parser location textproc filename) ((procedure?) string?)
#(define-void-function (parser location filename) (string?)
#{
\bookOutputName #filename
#}
@ -125,7 +125,15 @@ includeSong =
(acons label additional-page-numbers additional-page-switch-label-list))
(set! song-list
(acons (string->symbol filename)
(acons 'label label (acons 'header HEADER (acons 'music MUSIC (acons 'layout LAYOUT (acons 'text #{ \markuplist \setsongfilename $filename $(if textproc (textproc TEXT) TEXT) #} '())))))
(acons 'label label
(acons 'header HEADER
(acons 'music MUSIC
(acons 'layout LAYOUT
(acons 'text-pages
(map (lambda (text)
#{ \markuplist \setsongfilename $filename $text #})
TEXT_PAGES)
'())))))
song-list))
))
@ -184,14 +192,14 @@ songs =
;(header (assq-ref songvars 'header))
(music (assq-ref songvars 'music))
(layout (assq-ref songvars 'layout))
(text (assq-ref songvars 'text))
(text-pages (assq-ref songvars 'text-pages))
(label (assq-ref songvars 'label)))
#{
\bookpart {
$header
\headerToTOC #header #label
\score { $music \layout { $layout } }
$text
$(add-text-pages text-pages)
}
#}))))))
(reverse song-list)

View File

@ -26,6 +26,34 @@ TEXT = \markuplist {
\TEXT
}
#(define TEXT_PAGES
(map
(lambda (text) #{
\markuplist {
\override #`(transposition . ,TRANSPOSITION)
\override #`(verselayout . ,verselayout)
\override #`(verse-chords . ,#{ \chords { \verseChords } #})
\override #`(verse-reference-voice . ,#{ \global \firstVoice #})
#text
}
#})
(if
(and
(defined? 'TEXT_PAGES)
(pair? TEXT_PAGES))
TEXT_PAGES
(list TEXT))))
#(define (add-text-pages text-pages)
(if (pair? text-pages)
(begin
(add-score (car text-pages))
(for-each
(lambda (text)
(add-music (pageBreak))
(add-score text))
(cdr text-pages)))))
#(if (not noStandaloneOutput)
(begin
(let ((header (ly:book-header HEADER)) (paper (ly:book-paper HEADER)))
@ -37,7 +65,7 @@ TEXT = \markuplist {
\MUSIC
\layout { \LAYOUT }
}#})
(add-score TEXT)
(add-text-pages TEXT_PAGES)
(add-score #{
\score {
\unfoldRepeats { \MUSIC \INLINESCOREMUSIC }