Autorensystem flexibilisiert
This commit is contained in:
@@ -30,6 +30,9 @@
|
||||
(lambda (a b) (< (cadr a) (cadr b))))
|
||||
(list)))
|
||||
|
||||
#(define (join-present items joiner)
|
||||
(string-join (filter (lambda (item) (and (string? item) (not (string-null? (string-trim-both item))))) items) joiner))
|
||||
|
||||
#(define-markup-command (print-songinfo layout props) ()
|
||||
(define (songinfo-from songId key)
|
||||
(let ((song (if (defined? 'SONG_DATA) (assoc-ref SONG_DATA songId) #f)))
|
||||
@@ -74,11 +77,7 @@
|
||||
(define (render-contribution-group contributionPrefix authorIds)
|
||||
(if (null? authorIds)
|
||||
""
|
||||
(string-append contributionPrefix " " (string-join (format-authors authorIds) ", ")))
|
||||
)
|
||||
|
||||
(define (join-present items joiner)
|
||||
(string-join (filter (lambda (item) (and (string? item) (not (string-null? (string-trim-both item))))) items) joiner)
|
||||
(string-append contributionPrefix " " ((ly:output-def-lookup layout 'author-joiner) (format-authors authorIds))))
|
||||
)
|
||||
|
||||
(define (render-partial-contribution-group prefixLookup authorData)
|
||||
@@ -94,93 +93,37 @@
|
||||
|
||||
(define (poet-and-composer-from-authors authors)
|
||||
(if authors
|
||||
(let (
|
||||
(poetIds (find-author-ids-by 'text authors))
|
||||
(translatorIds (find-author-ids-by 'translation authors))
|
||||
(versePoetData (find-author-id-with-part-numbers 'verse authors))
|
||||
(composerIds (find-author-ids-by 'melody authors))
|
||||
(verseComposerData (find-author-id-with-part-numbers 'meloverse authors))
|
||||
(voiceComposerData (find-author-id-with-part-numbers 'voice authors))
|
||||
(compositionIds (find-author-ids-by 'composition authors))
|
||||
(adaptionTextIds (find-author-ids-by 'adaption_text authors))
|
||||
(adaptionMusicIds (find-author-ids-by 'adaption_music 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))
|
||||
(year_adaption_text (chain-assoc-get 'header:year_adaption_text props #f))
|
||||
(year_adaption_music (chain-assoc-get 'header:year_adaption_music props #f))
|
||||
)
|
||||
(if (and
|
||||
(equal? poetIds composerIds)
|
||||
(null? translatorIds)
|
||||
(null? versePoetData)
|
||||
(null? verseComposerData)
|
||||
(null? voiceComposerData)
|
||||
(null? compositionIds)
|
||||
(null? adaptionTextIds)
|
||||
(null? adaptionMusicIds)
|
||||
(null? bridgeIds)
|
||||
(null? interludeIds))
|
||||
(list
|
||||
(join-present (list
|
||||
(render-contribution-group (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) poetIds)
|
||||
(if (equal? year_text year_melody) year_text (join-present (list year_text year_melody) "/"))
|
||||
) ", ")
|
||||
#f)
|
||||
(list
|
||||
(if (and (null? poetIds) (null? versePoetData) (null? translatorIds)) #f
|
||||
(string-append
|
||||
(ly:output-def-lookup layout 'poetPrefix)
|
||||
" "
|
||||
(join-present (list
|
||||
(join-present (list
|
||||
(render-contribution-group "" poetIds)
|
||||
year_text
|
||||
) ", ")
|
||||
(render-partial-contribution-group 'versePrefix versePoetData)
|
||||
(join-present (list
|
||||
(render-contribution-group (ly:output-def-lookup layout 'translationAuthorPrefix) translatorIds)
|
||||
year_translation
|
||||
) ", ")
|
||||
(join-present (list
|
||||
(render-contribution-group (ly:output-def-lookup layout 'adaptionTextPrefix) adaptionTextIds)
|
||||
year_adaption_text
|
||||
) ", ")
|
||||
) "; ")
|
||||
))
|
||||
(if (and
|
||||
(null? composerIds)
|
||||
(null? compositionIds)
|
||||
(null? adaptionMusicIds)
|
||||
(null? verseComposerData)
|
||||
(null? voiceComposerData)
|
||||
(null? bridgeIds)
|
||||
(null? interludeIds)) #f
|
||||
(string-append
|
||||
(ly:output-def-lookup layout 'composerPrefix)
|
||||
" "
|
||||
(join-present (list
|
||||
(join-present (list
|
||||
(render-contribution-group "" composerIds)
|
||||
year_melody
|
||||
) ", ")
|
||||
(render-partial-contribution-group 'versePrefix verseComposerData)
|
||||
(render-partial-contribution-group 'voicePrefix voiceComposerData)
|
||||
(join-present (list
|
||||
(render-contribution-group (ly:output-def-lookup layout 'compositionPrefix) compositionIds)
|
||||
year_composition
|
||||
) ", ")
|
||||
(join-present (list
|
||||
(render-contribution-group (ly:output-def-lookup layout 'adaptionMusicPrefix) adaptionMusicIds)
|
||||
year_adaption_music
|
||||
) ", ")
|
||||
(render-contribution-group (ly:output-def-lookup layout 'bridgePrefix) bridgeIds)
|
||||
(render-contribution-group (ly:output-def-lookup layout 'interludePrefix) interludeIds)
|
||||
) "; ")
|
||||
)))))
|
||||
((ly:output-def-lookup layout 'authorContributionFormat)
|
||||
render-contribution-group
|
||||
render-partial-contribution-group
|
||||
#:poetIds (find-author-ids-by 'text authors)
|
||||
#:translatorIds (find-author-ids-by 'translation authors)
|
||||
#:versePoetData (find-author-id-with-part-numbers 'verse authors)
|
||||
#:composerIds (find-author-ids-by 'melody authors)
|
||||
#:verseComposerData (find-author-id-with-part-numbers 'meloverse authors)
|
||||
#:voiceComposerData (find-author-id-with-part-numbers 'voice authors)
|
||||
#:compositionIds (find-author-ids-by 'composition authors)
|
||||
#:adaptionTextIds (find-author-ids-by 'adaption_text authors)
|
||||
#:adaptionMusicIds (find-author-ids-by 'adaption_music 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)
|
||||
#:year_adaption_text (chain-assoc-get 'header:year_adaption_text props #f)
|
||||
#:year_adaption_music (chain-assoc-get 'header:year_adaption_music props #f)
|
||||
#:poetAndComposerEqualPrefix (ly:output-def-lookup layout 'poetAndComposerEqualPrefix)
|
||||
#:poetPrefix (ly:output-def-lookup layout 'poetPrefix)
|
||||
#:composerPrefix (ly:output-def-lookup layout 'composerPrefix)
|
||||
#:translationPrefix (ly:output-def-lookup layout 'translationPrefix)
|
||||
#:pronunciationPrefix (ly:output-def-lookup layout 'pronunciationPrefix)
|
||||
#:compositionPrefix (ly:output-def-lookup layout 'compositionPrefix)
|
||||
#:adaptionTextPrefix (ly:output-def-lookup layout 'adaptionTextPrefix)
|
||||
#:adaptionMusicPrefix (ly:output-def-lookup layout 'adaptionMusicPrefix)
|
||||
#:bridgePrefix (ly:output-def-lookup layout 'bridgePrefix)
|
||||
#:interludePrefix (ly:output-def-lookup layout 'interludePrefix)
|
||||
)
|
||||
(list #f #f)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user