diff --git a/all_base_includes.ly b/all_base_includes.ly index 8dcb451..652abf6 100644 --- a/all_base_includes.ly +++ b/all_base_includes.ly @@ -34,7 +34,8 @@ LAYOUT = \layout { \generalLayout } HEADER = {} MUSIC = {} -TEXT = \markuplist {""} +TEXT = \markuplist {} +TEXT_PAGES = #f verseChords = {} firstVoice = {} diff --git a/book_include.ly b/book_include.ly index 9832013..edba148 100644 --- a/book_include.ly +++ b/book_include.ly @@ -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) diff --git a/standalone_output.ly b/standalone_output.ly index af9cd31..ab9b9fe 100644 --- a/standalone_output.ly +++ b/standalone_output.ly @@ -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 }