lilypond-common-includes/appendix.ly

44 lines
1.5 KiB
Plaintext
Raw Permalink Normal View History

2024-11-23 23:51:01 +01:00
appendix =
#(define-void-function (parser location title) (markup?)
(define (appendix-item->markup layout props appendix-item)
(interpret-markup layout props
(markup
#:override (cons 'appendixItem:heading (assoc-ref appendix-item "heading"))
#:override (cons 'appendixItem:text (assoc-ref appendix-item "text"))
(ly:output-def-lookup layout 'appendixItemMarkup))))
(ly:book-add-bookpart! (ly:parser-lookup '$current-book)
#{
\bookpart {
\markup { #title }
#(for-each
(lambda (item)
(add-score (ly:make-page-label-marker (string->symbol (car item))))
(add-text
(make-on-the-fly-markup
(lambda (layout props arg) (appendix-item->markup layout props (cdr item)))
(make-null-markup)))
)
(reverse APPENDIX_DATA))
}
#}))
#(define-markup-command (appendix-ref layout props label) (symbol?)
"call page-ref to appendix-item"
(interpret-markup layout props
(markup #:with-link label
#:override (cons 'appendixPage (make-page-ref-markup label "XXX" "?"))
(ly:output-def-lookup layout 'appendixReferenceMarkup))))
\paper {
appendixItemMarkup = \markup {
\left-column {
\line { \large \bold \fromproperty #'appendixItem:heading }
\vspace #0.2
\sans \wordwrap-field #'appendixItem:text
\vspace #0.7
}
}
appendixReferenceMarkup = \markup {
\fromproperty #'appendixPage
}
}