neues System für Autorenangaben
This commit is contained in:
		| @@ -1,32 +0,0 @@ | |||||||
| \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)) |  | ||||||
|               (string-present (lambda (str) (and str (not (and (string? str) (string-null? str)))))) |  | ||||||
|               (render_informations (lambda (infolist) (string-append (car infolist) (if (null? (cdr infolist)) "" (string-append " (" (string-join (cdr infolist) ", ") ")"))))) |  | ||||||
|               ) |  | ||||||
|           (interpret-markup layout props |  | ||||||
|             (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 |  | ||||||
|               ))) |  | ||||||
|               "" |  | ||||||
|           )))) |  | ||||||
|       (make-null-markup) |  | ||||||
|     ) |  | ||||||
|   poetMarkup = \markup { "Worte:" \fromproperty #'author } |  | ||||||
|   composerMarkup = \markup { "Weise:" \fromproperty #'author } |  | ||||||
|   poetAndComposerEqualMarkup = \markup { "Worte und Weise:" \fromproperty #'author } |  | ||||||
| } |  | ||||||
| @@ -1,8 +1,30 @@ | |||||||
| \paper { | \paper { | ||||||
|  |   poetPrefix = "Worte:" | ||||||
|  |   composerPrefix = "Weise:" | ||||||
|  |   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 | ||||||
|  |               ))) | ||||||
|  |               "" | ||||||
|  |           ))) | ||||||
|  |  | ||||||
|   songinfoMarkup = |   songinfoMarkup = | ||||||
|     #(make-on-the-fly-markup |     #(make-on-the-fly-markup | ||||||
|       (lambda (layout props m) |       (lambda (layout props m) | ||||||
|         (let ((between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3))) |         (let* ((between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3))) | ||||||
|               (poet-maybe-with-composer (chain-assoc-get 'songinfo:poet-maybe-with-composer props #f)) |               (poet-maybe-with-composer (chain-assoc-get 'songinfo:poet-maybe-with-composer props #f)) | ||||||
|               (composer (chain-assoc-get 'songinfo:composer props #f)) |               (composer (chain-assoc-get 'songinfo:composer props #f)) | ||||||
|               (copyright (chain-assoc-get 'songinfo:copyright props #f)) |               (copyright (chain-assoc-get 'songinfo:copyright props #f)) | ||||||
| @@ -10,16 +32,22 @@ | |||||||
|               (translation (chain-assoc-get 'songinfo:translation props #f)) |               (translation (chain-assoc-get 'songinfo:translation props #f)) | ||||||
|               (pronunciation (chain-assoc-get 'songinfo:pronunciation props #f)) |               (pronunciation (chain-assoc-get 'songinfo:pronunciation props #f)) | ||||||
|               (year_text (chain-assoc-get 'songinfo:year_text props #f)) |               (year_text (chain-assoc-get 'songinfo:year_text props #f)) | ||||||
|               (year_melody (chain-assoc-get 'songinfo:year_melody props #f))) |               (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)))) | ||||||
|           (stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props) |           (stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props) | ||||||
|             (interpret-markup-list layout props |             (interpret-markup-list layout props | ||||||
|               (append |               (append | ||||||
|                 (make-wordwrap-internal-markup-list #t (list |                 (if (and poet-and-composer-oneliner (< (interval-length (ly:stencil-extent (interpret-markup layout props poet-and-composer-oneliner) X)) current-line-width)) | ||||||
|                   (if poet-maybe-with-composer (markup |                   (list poet-and-composer-oneliner) | ||||||
|                       (if year_text (make-concat-markup (list poet-maybe-with-composer ", " year_text)) poet-maybe-with-composer) between-poet-and-composer-markup) "") |                   (make-wordwrap-string-internal-markup-list #t (string-append | ||||||
|                     (if composer (if year_melody (make-concat-markup (list composer ", " year_melody)) composer) ""))) |                     (if poet-with-year (string-append "\n\n" poet-with-year) "") | ||||||
|  |                     (if composer-with-year (string-append "\n\n" composer-with-year) "") | ||||||
|  |                   ))) | ||||||
|                 (make-wordwrap-string-internal-markup-list #t (string-append |                 (make-wordwrap-string-internal-markup-list #t (string-append | ||||||
|                   (if copyright (string-append "© " copyright) "") |                   (if copyright (string-append "\n\n© " copyright) "") | ||||||
|                   (if infotext (string-append "\n\n" infotext) "") |                   (if infotext (string-append "\n\n" infotext) "") | ||||||
|                   (if translation (string-append "\n\nÜbersetzung: " translation) "") |                   (if translation (string-append "\n\nÜbersetzung: " translation) "") | ||||||
|                   (if pronunciation (string-append "\n\nAussprache: " pronunciation) "")))))))) |                   (if pronunciation (string-append "\n\nAussprache: " pronunciation) "")))))))) | ||||||
|   | |||||||
| @@ -5,36 +5,59 @@ | |||||||
|         (assoc-ref song key) |         (assoc-ref song key) | ||||||
|         (ly:warning (ly:format "song with id ~a not found" songId))))) |         (ly:warning (ly:format "song with id ~a not found" songId))))) | ||||||
|  |  | ||||||
|   (define (format-author authorId) |   (define (format-author authorId noDetails) | ||||||
|     (let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f))) |     (let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f))) | ||||||
|       (if author |       (if author | ||||||
|         (markup |         ((ly:output-def-lookup layout 'authorFormat) | ||||||
|           #:override (cons 'author:name (assoc-ref author "name")) |           noDetails | ||||||
|           #:override (cons 'author:trail_name (assoc-ref author "trail_name")) |           (assoc-ref author "name") | ||||||
|           #:override (cons 'author:birth_year (assoc-ref author "birth_year")) |           (assoc-ref author "trail_name") | ||||||
|           #:override (cons 'author:death_year (assoc-ref author "death_year")) |           (assoc-ref author "birth_year") | ||||||
|           #:override (cons 'author:organization (assoc-ref author "organization")) |           (assoc-ref author "death_year") | ||||||
|           (ly:output-def-lookup layout 'authorMarkup)) |           (assoc-ref author "organization") | ||||||
|  |         ) | ||||||
|         (ly:warning (ly:format "author with id ~a not found" authorId))))) |         (ly:warning (ly:format "author with id ~a not found" authorId))))) | ||||||
|  |  | ||||||
|   (define (format-poet poetId) |   (define (format-poet poetId) | ||||||
|     (markup #:override (cons 'author (format-author poetId)) (ly:output-def-lookup layout 'poetMarkup))) |     (string-append (ly:output-def-lookup layout 'poetPrefix) " " (format-author poetId #f))) | ||||||
|  |  | ||||||
|   (define (format-composer composerId) |   (define (format-composer composerId) | ||||||
|     (markup #:override (cons 'author (format-author composerId)) (ly:output-def-lookup layout 'composerMarkup))) |     (string-append (ly:output-def-lookup layout 'composerPrefix) " " (format-author composerId #f))) | ||||||
|  |  | ||||||
|   (define (format-poet-and-composer authorId) |   (define (format-poet-and-composer authorId) | ||||||
|     (markup #:override (cons 'author (format-author authorId)) (ly:output-def-lookup layout 'poetAndComposerEqualMarkup))) |     (string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (format-author authorId #f))) | ||||||
|  |  | ||||||
|  |   (define (find-authors-by authorType authors) | ||||||
|  |     (filter-map (lambda (authordata) (if (member authorType authordata) (car authordata) #f)) authors) | ||||||
|  |   ) | ||||||
|  |  | ||||||
|  |   (define (poet-and-composer-from-authors authors) | ||||||
|  |     (if authors | ||||||
|  |       (let* ( | ||||||
|  |             (poetIds (find-authors-by 'text authors)) | ||||||
|  |             (composerIds (find-authors-by 'melody authors)) | ||||||
|  |             (poets (map (lambda (poetId) (format-author poetId #f)) poetIds)) | ||||||
|  |             (composers (map (lambda (composerId) (format-author composerId (member composerId poetIds))) composerIds))) | ||||||
|  |         (if (equal? poetIds composerIds) | ||||||
|  |           (list (string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (string-join poets ", ")) #f) | ||||||
|  |           (list | ||||||
|  |             (string-append (ly:output-def-lookup layout 'poetPrefix) " " (string-join poets ", ")) | ||||||
|  |             (string-append (ly:output-def-lookup layout 'composerPrefix) " " (string-join composers ", "))))) | ||||||
|  |       (list #f #f) | ||||||
|  |     ) | ||||||
|  |   ) | ||||||
|  |  | ||||||
|   (interpret-markup layout props |   (interpret-markup layout props | ||||||
|     (if (chain-assoc-get 'page:is-bookpart-last-page props #f) |     (if (chain-assoc-get 'page:is-bookpart-last-page props #f) | ||||||
|     (let* ((songId (chain-assoc-get 'header:songId props #f)) |     (let* ((authors (chain-assoc-get 'header:authors props #f)) | ||||||
|  |            (poet-and-composers (poet-and-composer-from-authors authors)) | ||||||
|  |            (songId (chain-assoc-get 'header:songId props #f)) | ||||||
|            (poetId (chain-assoc-get 'header:poetId props (if songId (songinfo-from songId "poet") #f))) |            (poetId (chain-assoc-get 'header:poetId props (if songId (songinfo-from songId "poet") #f))) | ||||||
|            (composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f))) |            (composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f))) | ||||||
|            (poet-and-composer-same (equal? poetId composerId))) |            (poet-and-composer-same (equal? poetId composerId))) | ||||||
|       (let ((infotext (chain-assoc-get 'header:infotext props (chain-assoc-get 'header:songinfo props #f))) |       (let ((infotext (chain-assoc-get 'header:infotext props (chain-assoc-get 'header:songinfo props #f))) | ||||||
|             (poet-maybe-with-composer (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f))) |             (poet-maybe-with-composer (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) (car poet-and-composers)))) | ||||||
|             (composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) #f))) |             (composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) (cadr poet-and-composers)))) | ||||||
|             (copyright (chain-assoc-get 'header:copyright props #f)) |             (copyright (chain-assoc-get 'header:copyright props #f)) | ||||||
|             (translation (chain-assoc-get 'header:translation props #f)) |             (translation (chain-assoc-get 'header:translation props #f)) | ||||||
|             (pronunciation (chain-assoc-get 'header:pronunciation props #f)) |             (pronunciation (chain-assoc-get 'header:pronunciation props #f)) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user