use \write-toc-csv in a markup to generate a toc.csv
This commit is contained in:
@ -1,4 +1,27 @@
|
||||
#(use-modules (ice-9 receive))
|
||||
#(define (format-author layout authorId noDetails)
|
||||
(let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f)))
|
||||
(if author
|
||||
((ly:output-def-lookup layout 'authorFormat)
|
||||
noDetails
|
||||
(assoc-ref author "name")
|
||||
(assoc-ref author "trail_name")
|
||||
(assoc-ref author "birth_year")
|
||||
(assoc-ref author "death_year")
|
||||
(assoc-ref author "organization")
|
||||
)
|
||||
"unbekannt")))
|
||||
|
||||
#(define (find-author-ids-by contributionType authors)
|
||||
(filter-map (lambda (authordata) (if (member contributionType (cdr authordata)) (car authordata) #f)) authors))
|
||||
|
||||
#(define (find-author-id-with-part-numbers contributionType authors)
|
||||
(filter-map (lambda (authordata)
|
||||
(let ((contributionNumbers (filter-map (lambda (contribution) (if (and (list? contribution) (equal? contributionType (car contribution))) (cadr contribution) #f)) (cdr authordata)))
|
||||
(authorId (car authordata)))
|
||||
(if (null? contributionNumbers) #f (cons authorId contributionNumbers))
|
||||
)) authors))
|
||||
|
||||
#(define-markup-command (print-songinfo layout props) ()
|
||||
(define (songinfo-from songId key)
|
||||
(let ((song (if (defined? 'SONG_DATA) (assoc-ref SONG_DATA songId) #f)))
|
||||
@ -6,39 +29,14 @@
|
||||
(assoc-ref song key)
|
||||
(ly:warning (ly:format "song with id ~a not found" songId)))))
|
||||
|
||||
(define (format-author authorId noDetails)
|
||||
(let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f)))
|
||||
(if author
|
||||
((ly:output-def-lookup layout 'authorFormat)
|
||||
noDetails
|
||||
(assoc-ref author "name")
|
||||
(assoc-ref author "trail_name")
|
||||
(assoc-ref author "birth_year")
|
||||
(assoc-ref author "death_year")
|
||||
(assoc-ref author "organization")
|
||||
)
|
||||
"unbekannt")))
|
||||
|
||||
(define (format-poet poetId)
|
||||
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (format-author poetId #f)))
|
||||
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (format-author layout poetId #f)))
|
||||
|
||||
(define (format-composer composerId)
|
||||
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (format-author composerId #f)))
|
||||
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (format-author layout composerId #f)))
|
||||
|
||||
(define (format-poet-and-composer authorId)
|
||||
(string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (format-author authorId #f)))
|
||||
|
||||
(define (find-author-ids-by contributionType authors)
|
||||
(filter-map (lambda (authordata) (if (member contributionType (cdr authordata)) (car authordata) #f)) authors)
|
||||
)
|
||||
|
||||
(define (find-author-id-with-part-numbers contributionType authors)
|
||||
(filter-map (lambda (authordata)
|
||||
(let ((contributionNumbers (filter-map (lambda (contribution) (if (and (list? contribution) (equal? contributionType (car contribution))) (cadr contribution) #f)) (cdr authordata)))
|
||||
(authorId (car authordata)))
|
||||
(if (null? contributionNumbers) #f (cons authorId contributionNumbers))
|
||||
)) authors)
|
||||
)
|
||||
(string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (format-author layout authorId #f)))
|
||||
|
||||
(define (numbered-contribution-prefix contributionNumbers prefixLookup)
|
||||
(string-append
|
||||
@ -53,6 +51,7 @@
|
||||
(define (format-authors authorIds)
|
||||
(map (lambda (authorId)
|
||||
(format-author
|
||||
layout
|
||||
authorId
|
||||
(if (member authorId referencedAuthors)
|
||||
#t
|
||||
|
Reference in New Issue
Block a user