rework authorsystem
* add translation, interlude, bridge and meloverse * fix rendering bugs
This commit is contained in:
parent
8c7386807b
commit
2366fa7755
@ -3,6 +3,11 @@
|
||||
composerPrefix = "Weise:"
|
||||
compositionPrefix = "Satz:"
|
||||
poetAndComposerEqualPrefix = "Worte und Weise:"
|
||||
voicePrefix = "Stimme:"
|
||||
versePrefix = "Strophe:"
|
||||
translationPrefix = "Übersetzung:"
|
||||
interludePrefix = "Zwischenspiel:"
|
||||
bridgePrefix = "Bridge:"
|
||||
|
||||
authorFormat =
|
||||
#(lambda (noDetails name trail_name birth_year death_year organization)
|
||||
|
@ -39,40 +39,101 @@
|
||||
)) authors)
|
||||
)
|
||||
|
||||
(define (render-contribution-numbers contributionNumbers)
|
||||
(string-join (map (lambda (contributionNumber) (ly:format "~a." contributionNumber)) contributionNumbers) ", ")
|
||||
(define (numbered-contribution-prefix contributionNumbers prefixLookup)
|
||||
(string-append
|
||||
(string-join (map (lambda (contributionNumber) (ly:format "~a." contributionNumber)) contributionNumbers) ", ")
|
||||
" "
|
||||
(ly:output-def-lookup layout prefixLookup)
|
||||
)
|
||||
(define (render-verse-contribution contributionNumbers)
|
||||
(string-append (render-contribution-numbers contributionNumbers) " Strophe: ")
|
||||
)
|
||||
|
||||
(define (render-voice-contribution contributionNumbers)
|
||||
(string-append (render-contribution-numbers contributionNumbers) " Stimme: ")
|
||||
(define referencedAuthors '())
|
||||
|
||||
(define (format-authors authorIds)
|
||||
(map (lambda (authorId)
|
||||
(format-author
|
||||
authorId
|
||||
(if (member authorId referencedAuthors)
|
||||
#t
|
||||
(begin
|
||||
(set! referencedAuthors (cons authorId referencedAuthors))
|
||||
#f)))
|
||||
) authorIds)
|
||||
)
|
||||
|
||||
(define (render-contribution-group contributionPrefix authorIds)
|
||||
(string-append contributionPrefix " " (string-join (format-authors authorIds) ", "))
|
||||
)
|
||||
|
||||
(define (render-partial-contribution-group prefixLookup authorData)
|
||||
(string-join
|
||||
(map (lambda (authorEntry) (render-contribution-group (numbered-contribution-prefix (cdr authorEntry) prefixLookup) (list (car authorEntry)))) authorData)
|
||||
" ")
|
||||
)
|
||||
|
||||
(define (join-present items)
|
||||
(string-join (filter string? items) "; ")
|
||||
)
|
||||
|
||||
(define (poet-and-composer-from-authors authors)
|
||||
(if authors
|
||||
(let* (
|
||||
(let (
|
||||
(poetIds (find-author-ids-by 'text authors))
|
||||
(translatorIds (find-author-ids-by 'translation authors))
|
||||
(versePoetData (find-author-id-with-part-numbers 'verse authors))
|
||||
(allPoetIds (append poetIds (map car versePoetData)))
|
||||
(composerIds (find-author-ids-by 'melody authors))
|
||||
(compositionIds (find-author-ids-by 'composition authors))
|
||||
(verseComposerData (find-author-id-with-part-numbers 'meloverse authors))
|
||||
(voiceComposerData (find-author-id-with-part-numbers 'voice authors))
|
||||
(poets (append
|
||||
(map (lambda (poetId) (format-author poetId #f)) poetIds)
|
||||
(map (lambda (versePoetEntry) (string-append (render-verse-contribution (cdr versePoetEntry)) (format-author (car versePoetEntry) (member (car versePoetEntry) poetIds)))) versePoetData)
|
||||
))
|
||||
(composers (append
|
||||
(map (lambda (composerId) (format-author composerId (member composerId allPoetIds))) composerIds)
|
||||
(map (lambda (composerId) (string-append (ly:output-def-lookup layout 'compositionPrefix) " " (format-author composerId (member composerId allPoetIds)))) compositionIds)
|
||||
(map (lambda (voiceComposerEntry) (string-append (render-voice-contribution (cdr voiceComposerEntry)) (format-author (car voiceComposerEntry) (member (car voiceComposerEntry) allPoetIds)))) voiceComposerData)
|
||||
)))
|
||||
(if (and (equal? poetIds composerIds) (null? versePoetData) (null? voiceComposerData) (null? compositionIds))
|
||||
(list (string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (string-join poets ", ")) #f)
|
||||
(compositionIds (find-author-ids-by 'composition authors))
|
||||
(bridgeIds (find-author-ids-by 'bridge authors))
|
||||
(interludeIds (find-author-ids-by 'interlude authors))
|
||||
)
|
||||
(if (and (equal? poetIds composerIds) (null? translatorIds) (null? versePoetData) (null? verseComposerData) (null? voiceComposerData) (null? compositionIds) (null? bridgeIds) (null? interludeIds))
|
||||
(list
|
||||
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (string-join poets ", "))
|
||||
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (string-join composers ", ")))))
|
||||
(render-contribution-group (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) poetIds)
|
||||
#f)
|
||||
(list
|
||||
(if (and (null? poetIds) (null? versePoetData) (null? translatorIds)) #f
|
||||
(string-append
|
||||
(ly:output-def-lookup layout 'poetPrefix)
|
||||
" "
|
||||
(join-present (list
|
||||
(if (not (null? poetIds))
|
||||
(render-contribution-group "" poetIds)
|
||||
#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)
|
||||
#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
|
||||
(if (not (null? composerIds))
|
||||
(render-contribution-group "" composerIds)
|
||||
#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)
|
||||
#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)
|
||||
)
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user