lilypond-common-includes/default_songinfo_style.ly

57 lines
3.5 KiB
Plaintext
Raw Normal View History

2023-10-31 13:31:50 +01:00
\paper {
2023-12-30 20:07:57 +01:00
poetPrefix = "Worte:"
composerPrefix = "Weise:"
compositionPrefix = "Satz:"
2023-12-30 20:07:57 +01:00
poetAndComposerEqualPrefix = "Worte und Weise:"
authorFormat =
#(lambda (noDetails name trail_name birth_year death_year organization)
(let ((string-present (lambda (str) (and str (not (and (string? str) (string-null? str))))))
(render_informations (lambda (infolist) (string-append (car infolist) (if (or noDetails (null? (cdr infolist))) "" (string-append " (" (string-join (cdr infolist) ", ") ")"))))))
(if (or (string-present trail_name) (string-present name))
(render_informations (filter string-present (list
trail_name
name
(if (and (string-present birth_year) (string-present death_year))
(ly:format "~a~a" birth_year death_year)
(if (string-present birth_year)
(ly:format "*~a" birth_year)
(if (string-present death_year) (ly:format "†~a" death_year) "")))
organization
)))
""
)))
2023-10-31 13:31:50 +01:00
songinfoMarkup =
#(make-on-the-fly-markup
(lambda (layout props m)
2023-12-30 20:07:57 +01:00
(let* ((between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
2023-10-31 13:31:50 +01:00
(poet-maybe-with-composer (chain-assoc-get 'songinfo:poet-maybe-with-composer props #f))
(composer (chain-assoc-get 'songinfo:composer props #f))
(copyright (chain-assoc-get 'songinfo:copyright props #f))
(infotext (chain-assoc-get 'songinfo:infotext props #f))
(translation (chain-assoc-get 'songinfo:translation props #f))
(pronunciation (chain-assoc-get 'songinfo:pronunciation props #f))
2023-10-31 13:31:50 +01:00
(year_text (chain-assoc-get 'songinfo:year_text props #f))
2023-12-30 20:07:57 +01:00
(year_melody (chain-assoc-get 'songinfo:year_melody props #f))
(poet-with-year (if (and poet-maybe-with-composer year_text) (string-append poet-maybe-with-composer ", " year_text) poet-maybe-with-composer))
(composer-with-year (if (and composer year_melody) (string-append composer ", " year_melody) composer))
(poet-and-composer-oneliner (if (and poet-with-year composer-with-year) (markup poet-with-year between-poet-and-composer-markup composer-with-year) #f))
(current-line-width (chain-assoc-get 'line-width props (ly:output-def-lookup layout 'line-width))))
2023-10-31 18:47:47 +01:00
(stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props)
(interpret-markup-list layout props
(append
2023-12-30 20:07:57 +01:00
(if (and poet-and-composer-oneliner (< (interval-length (ly:stencil-extent (interpret-markup layout props poet-and-composer-oneliner) X)) current-line-width))
(list poet-and-composer-oneliner)
(make-wordwrap-string-internal-markup-list #t (string-append
(if poet-with-year (string-append "\n\n" poet-with-year) "")
(if composer-with-year (string-append "\n\n" composer-with-year) "")
)))
2023-10-31 18:47:47 +01:00
(make-wordwrap-string-internal-markup-list #t (string-append
2023-12-30 20:07:57 +01:00
(if copyright (string-append "\n\n© " copyright) "")
2023-10-31 13:31:50 +01:00
(if infotext (string-append "\n\n" infotext) "")
(if translation (string-append "\n\nÜbersetzung: " translation) "")
(if pronunciation (string-append "\n\nAussprache: " pronunciation) ""))))))))
2023-10-31 13:31:50 +01:00
(make-null-markup)
)
}