Refactor author-format function
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
#(use-modules (ice-9 receive))
|
||||
#(define (format-author layout authorId noDetails)
|
||||
#(define (format-author author-format-function authorId noDetails)
|
||||
(let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f)))
|
||||
(if author
|
||||
((ly:output-def-lookup layout 'authorFormat)
|
||||
(author-format-function
|
||||
noDetails
|
||||
(assoc-ref author "name")
|
||||
(assoc-ref author "trail_name")
|
||||
@ -29,14 +29,17 @@
|
||||
(assoc-ref song key)
|
||||
(ly:warning (ly:format "song with id ~a not found" songId)))))
|
||||
|
||||
(define* (default-author-format authorId #:optional (noDetails #f))
|
||||
(format-author (ly:output-def-lookup layout 'authorFormat) authorId noDetails))
|
||||
|
||||
(define (format-poet poetId)
|
||||
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (format-author layout poetId #f)))
|
||||
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (default-author-format poetId)))
|
||||
|
||||
(define (format-composer composerId)
|
||||
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (format-author layout composerId #f)))
|
||||
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (default-author-format composerId)))
|
||||
|
||||
(define (format-poet-and-composer authorId)
|
||||
(string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (format-author layout authorId #f)))
|
||||
(string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (default-author-format authorId)))
|
||||
|
||||
(define (numbered-contribution-prefix contributionNumbers prefixLookup)
|
||||
(string-append
|
||||
@ -50,8 +53,7 @@
|
||||
|
||||
(define (format-authors authorIds)
|
||||
(map (lambda (authorId)
|
||||
(format-author
|
||||
layout
|
||||
(default-author-format
|
||||
authorId
|
||||
(if (member authorId referencedAuthors)
|
||||
#t
|
||||
|
Reference in New Issue
Block a user