|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
#(use-modules (ice-9 receive))
|
|
|
|
|
#(define-markup-command (print-songinfo layout props) ()
|
|
|
|
|
(define (songinfo-from songId key)
|
|
|
|
|
(let ((song (if (defined? 'SONG_DATA) (assoc-ref SONG_DATA songId) #f)))
|
|
|
|
@ -63,26 +62,17 @@
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(define (render-contribution-group contributionPrefix authorIds)
|
|
|
|
|
(if (null? authorIds)
|
|
|
|
|
""
|
|
|
|
|
(string-append contributionPrefix " " (string-join (format-authors authorIds) ", ")))
|
|
|
|
|
(string-append contributionPrefix " " (string-join (format-authors authorIds) ", "))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(define (render-partial-contribution-group prefixLookup authorData)
|
|
|
|
|
(if (null? authorData)
|
|
|
|
|
""
|
|
|
|
|
(let ((firstAuthorContributions (cdar authorData)))
|
|
|
|
|
(receive (authorDataSame authorDataOther)
|
|
|
|
|
(partition (lambda (authorEntry) (equal? (cdr authorEntry) firstAuthorContributions)) authorData)
|
|
|
|
|
(string-append
|
|
|
|
|
(render-contribution-group (numbered-contribution-prefix firstAuthorContributions prefixLookup) (map car authorDataSame))
|
|
|
|
|
" "
|
|
|
|
|
(render-partial-contribution-group prefixLookup authorDataOther)
|
|
|
|
|
))))
|
|
|
|
|
(string-join
|
|
|
|
|
(map (lambda (authorEntry) (render-contribution-group (numbered-contribution-prefix (cdr authorEntry) prefixLookup) (list (car authorEntry)))) authorData)
|
|
|
|
|
" ")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(define (join-present items joiner)
|
|
|
|
|
(string-join (filter (lambda (item) (and (string? item) (not (string-null? (string-trim-both item))))) items) joiner)
|
|
|
|
|
(define (join-present items)
|
|
|
|
|
(string-join (filter string? items) "; ")
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(define (poet-and-composer-from-authors authors)
|
|
|
|
@ -97,10 +87,6 @@
|
|
|
|
|
(compositionIds (find-author-ids-by 'composition authors))
|
|
|
|
|
(bridgeIds (find-author-ids-by 'bridge authors))
|
|
|
|
|
(interludeIds (find-author-ids-by 'interlude authors))
|
|
|
|
|
(year_text (chain-assoc-get 'header:year_text props #f))
|
|
|
|
|
(year_translation (chain-assoc-get 'header:year_translation props #f))
|
|
|
|
|
(year_melody (chain-assoc-get 'header:year_melody props #f))
|
|
|
|
|
(year_composition (chain-assoc-get 'header:year_composition props #f))
|
|
|
|
|
)
|
|
|
|
|
(if (and (equal? poetIds composerIds) (null? translatorIds) (null? versePoetData) (null? verseComposerData) (null? voiceComposerData) (null? compositionIds) (null? bridgeIds) (null? interludeIds))
|
|
|
|
|
(list
|
|
|
|
@ -112,35 +98,41 @@
|
|
|
|
|
(ly:output-def-lookup layout 'poetPrefix)
|
|
|
|
|
" "
|
|
|
|
|
(join-present (list
|
|
|
|
|
(join-present (list
|
|
|
|
|
(if (not (null? poetIds))
|
|
|
|
|
(render-contribution-group "" poetIds)
|
|
|
|
|
year_text
|
|
|
|
|
) ", ")
|
|
|
|
|
(render-partial-contribution-group 'versePrefix versePoetData)
|
|
|
|
|
(join-present (list
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? versePoetData))
|
|
|
|
|
(render-partial-contribution-group 'versePrefix versePoetData)
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? translatorIds))
|
|
|
|
|
(render-contribution-group (ly:output-def-lookup layout 'translationPrefix) translatorIds)
|
|
|
|
|
year_translation
|
|
|
|
|
) ", ")
|
|
|
|
|
) "; ")
|
|
|
|
|
#f)
|
|
|
|
|
))
|
|
|
|
|
))
|
|
|
|
|
(if (and (null? composerIds) (null? compositionIds) (null? verseComposerData) (null? voiceComposerData) (null? bridgeIds) (null? interludeIds)) #f
|
|
|
|
|
(string-append
|
|
|
|
|
(ly:output-def-lookup layout 'composerPrefix)
|
|
|
|
|
" "
|
|
|
|
|
(join-present (list
|
|
|
|
|
(join-present (list
|
|
|
|
|
(if (not (null? composerIds))
|
|
|
|
|
(render-contribution-group "" composerIds)
|
|
|
|
|
year_melody
|
|
|
|
|
) ", ")
|
|
|
|
|
(render-partial-contribution-group 'versePrefix verseComposerData)
|
|
|
|
|
(render-partial-contribution-group 'voicePrefix voiceComposerData)
|
|
|
|
|
(join-present (list
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? verseComposerData))
|
|
|
|
|
(render-partial-contribution-group 'versePrefix verseComposerData)
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? voiceComposerData))
|
|
|
|
|
(render-partial-contribution-group 'voicePrefix voiceComposerData)
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? compositionIds))
|
|
|
|
|
(render-contribution-group (ly:output-def-lookup layout 'compositionPrefix) compositionIds)
|
|
|
|
|
year_composition
|
|
|
|
|
) ", ")
|
|
|
|
|
(render-contribution-group (ly:output-def-lookup layout 'bridgePrefix) bridgeIds)
|
|
|
|
|
(render-contribution-group (ly:output-def-lookup layout 'interludePrefix) interludeIds)
|
|
|
|
|
) "; ")
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? bridgeIds))
|
|
|
|
|
(render-contribution-group (ly:output-def-lookup layout 'bridgePrefix) bridgeIds)
|
|
|
|
|
#f)
|
|
|
|
|
(if (not (null? interludeIds))
|
|
|
|
|
(render-contribution-group (ly:output-def-lookup layout 'interludePrefix) interludeIds)
|
|
|
|
|
#f)
|
|
|
|
|
))
|
|
|
|
|
)))))
|
|
|
|
|
(list #f #f)
|
|
|
|
|
)
|
|
|
|
@ -160,8 +152,8 @@
|
|
|
|
|
(copyright (chain-assoc-get 'header:copyright props #f))
|
|
|
|
|
(translation (chain-assoc-get 'header:translation props #f))
|
|
|
|
|
(pronunciation (chain-assoc-get 'header:pronunciation props #f))
|
|
|
|
|
(year_text (if (string? (car poet-and-composers)) #f (chain-assoc-get 'header:year_text props #f)))
|
|
|
|
|
(year_melody (if (string? (car poet-and-composers)) #f (chain-assoc-get 'header:year_melody props #f))))
|
|
|
|
|
(year_text (chain-assoc-get 'header:year_text props #f))
|
|
|
|
|
(year_melody (chain-assoc-get 'header:year_melody props #f)))
|
|
|
|
|
(markup
|
|
|
|
|
#:override (cons 'songinfo:poet-maybe-with-composer
|
|
|
|
|
(if (and poet-maybe-with-composer (not (and (string? poet-maybe-with-composer) (string-null? poet-maybe-with-composer)))) poet-maybe-with-composer #f))
|
|
|
|
|