diff --git a/basic_format_and_style_settings.ly b/basic_format_and_style_settings.ly index 5545af6..5cc906e 100644 --- a/basic_format_and_style_settings.ly +++ b/basic_format_and_style_settings.ly @@ -1,5 +1,6 @@ \language "deutsch" +\include "default_author_style.ly" \include "styles.ly" \include #(ly:format "styles/~a.ly" songStyle) diff --git a/default_author_style.ly b/default_author_style.ly new file mode 100644 index 0000000..f320b1e --- /dev/null +++ b/default_author_style.ly @@ -0,0 +1,26 @@ +\paper { + authorMarkup = + #(make-on-the-fly-markup + (lambda (layout props m) + (let ((name (chain-assoc-get 'author:name props #f)) + (trail_name (chain-assoc-get 'author:trail_name props #f)) + (birth_year (chain-assoc-get 'author:birth_year props #f)) + (death_year (chain-assoc-get 'author:death_year props #f)) + (organization (chain-assoc-get 'author:organization props #f))) + (interpret-markup layout props + (string-append + name + (if trail_name (ly:format " (~a)" trail_name) "") + (if (and birth_year death_year) + (ly:format ", (~a‒~a)" birth_year death_year) + (if birth_year + (ly:format ", (*~a)" birth_year) + (if death_year (ly:format ", (†~a)" death_year) ""))) + (if organization (ly:format ", ~a" organization) "") + )))) + (make-null-markup) + ) + poetMarkup = \markup { "Worte:" \fromproperty #'author } + composerMarkup = \markup { "Weise:" \fromproperty #'author } + poetAndComposerEqualMarkup = \markup { "Worte und Weise:" \fromproperty #'author } +} \ No newline at end of file diff --git a/footer_with_songinfo.ly b/footer_with_songinfo.ly index ed71c2a..919e182 100644 --- a/footer_with_songinfo.ly +++ b/footer_with_songinfo.ly @@ -1,33 +1,58 @@ #(define-markup-command (print-songinfo layout props) () - (interpret-markup layout props - (let ( - (blockwidth (* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width))) - (infotext (chain-assoc-get 'header:songinfo props #f)) - (poet (chain-assoc-get 'header:poet props #f)) - (composer (chain-assoc-get 'header:composer props #f)) - (poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked)) - (between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3))) - (copyright (chain-assoc-get 'header:copyright props #f))) - (if (chain-assoc-get 'page:is-bookpart-last-page props #f) - (markup #:override '(baseline-skip . 3.0) ( - make-fontsize-markup songInfoFontSize - (make-sans-markup - ;%\override #'(line-width . 92) \wordwrap-field #symbol - (make-column-markup (list - (make-line-markup - (list - (if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "") - (if (and composer (not poet-and-composer-stacked)) composer "")) - ) - (if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "") - (make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append - (if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "") - (if infotext infotext "") - ))) - ))) - ) - ) - (make-null-markup)))) + (define (format-author authorId) + (let ((author (if (defined? 'AUTHORS) (assq-ref AUTHORS authorId) #f))) + (if author + (markup + #:override (cons 'author:name (assq-ref author 'name)) + #:override (cons 'author:trail_name (assq-ref author 'trail_name)) + #:override (cons 'author:birth_year (assq-ref author 'birth_year)) + #:override (cons 'author:death_year (assq-ref author 'death_year)) + #:override (cons 'author:organization (assq-ref author 'organization)) + (ly:output-def-lookup layout 'authorMarkup)) + (ly:warning (ly:format "author with id ~a not found" authorId))))) + + (define (format-poet poetId) + (markup #:override (cons 'author (format-author poetId)) (ly:output-def-lookup layout 'poetMarkup))) + + (define (format-composer composerId) + (markup #:override (cons 'author (format-author composerId)) (ly:output-def-lookup layout 'composerMarkup))) + + (define (format-poet-and-composer authorId) + (markup #:override (cons 'author (format-author authorId)) (ly:output-def-lookup layout 'poetAndComposerEqualMarkup))) + + (interpret-markup layout props + (if (chain-assoc-get 'page:is-bookpart-last-page props #f) + (let* ((poetId (chain-assoc-get 'header:poetId props #f)) + (composerId (chain-assoc-get 'header:composerId props #f)) + (poet-and-composer-same (eq? poetId composerId))) + (let ( + (blockwidth (* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width))) + (infotext (chain-assoc-get 'header:songinfo props #f)) + (poet (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f))) + (composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) #f))) + (poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked)) + (between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3))) + (copyright (chain-assoc-get 'header:copyright props #f))) + (markup #:override '(baseline-skip . 3.0) ( + make-fontsize-markup songInfoFontSize + (make-sans-markup + ;%\override #'(line-width . 92) \wordwrap-field #symbol + (make-column-markup (list + (make-line-markup + (list + (if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "") + (if (and composer (not poet-and-composer-stacked)) composer "")) + ) + (if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "") + (make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append + (if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "") + (if infotext infotext "") + ))) + ))) + ) + ) + )) + (make-null-markup))) ) #(define-markup-command (print-pagenumber layout props)()