115 lines
3.2 KiB
Plaintext
115 lines
3.2 KiB
Plaintext
MUSIC = { \transposable #TRANSPOSITION \MUSIC }
|
|
|
|
LAYOUT = \layout {
|
|
\LAYOUT
|
|
#(customized-layout LAYOUT)
|
|
}
|
|
|
|
verselayout = \layout {
|
|
\LAYOUT
|
|
\context {
|
|
\ChordNames
|
|
\override ChordName.font-size = \songTextChordFontSize
|
|
}
|
|
}
|
|
|
|
TEXT = \markuplist {
|
|
\override #`(transposition . ,TRANSPOSITION)
|
|
\override #`(verselayout . ,verselayout)
|
|
\override #`(verse-chords . ,#{ \chords { \verseChords } #})
|
|
\override #`(verse-reference-voice . ,#{ \global \firstVoice #})
|
|
\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))))
|
|
|
|
%% Add invisible ChordPro write trigger to last TEXT_PAGES markuplist
|
|
#(when (and (defined? 'chordpro-export-enabled) chordpro-export-enabled (pair? TEXT_PAGES))
|
|
(let* ((last-index (- (length TEXT_PAGES) 1))
|
|
(last-page (list-ref TEXT_PAGES last-index))
|
|
(modified-last-page #{
|
|
\markuplist {
|
|
#last-page
|
|
\chordpro-delayed-write
|
|
}
|
|
#}))
|
|
(set! TEXT_PAGES
|
|
(append (list-head TEXT_PAGES last-index)
|
|
(list modified-last-page)))))
|
|
|
|
#(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)))
|
|
(if header (set! $defaultheader header))
|
|
(if paper (set! $defaultpaper paper))
|
|
)
|
|
|
|
;; ChordPro export: Store filename and extract metadata from basicSongInfo FIRST
|
|
(when (and (defined? 'chordpro-export-enabled) chordpro-export-enabled)
|
|
;; Use ly:parser-output-name which returns the output basename
|
|
;; This will write relative to current working directory (same as PDF)
|
|
(let ((output-name (ly:parser-output-name)))
|
|
(set! chordpro-current-filename output-name))
|
|
|
|
;; Try to extract metadata from basicSongInfo \header block
|
|
(when (defined? 'basicSongInfo)
|
|
(let* ((header-alist (ly:module->alist basicSongInfo))
|
|
(title (assoc-ref header-alist 'title))
|
|
(authors (assoc-ref header-alist 'authors)))
|
|
(when title
|
|
(set! chordpro-header-title
|
|
(if (markup? title)
|
|
(markup->string title)
|
|
(if (string? title) title "Untitled"))))
|
|
(when authors
|
|
(set! chordpro-header-authors authors)))))
|
|
|
|
(add-score #{
|
|
\score {
|
|
\MUSIC
|
|
\layout { \LAYOUT }
|
|
}#})
|
|
(add-text-pages TEXT_PAGES)
|
|
|
|
(add-score #{
|
|
\score {
|
|
\unfoldRepeats { \MUSIC \INLINESCOREMUSIC }
|
|
\midi {
|
|
\context {
|
|
\Staff
|
|
\remove "Staff_performer"
|
|
}
|
|
\context {
|
|
\Voice
|
|
\consists "Staff_performer"
|
|
}
|
|
}
|
|
}#})
|
|
))
|