sort contributions
This commit is contained in:
parent
cc4fc9f297
commit
654f619fba
@ -21,11 +21,13 @@
|
||||
|
||||
#(define (find-author-id-with-part-numbers contributionType authors)
|
||||
(if 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)
|
||||
(sort-list
|
||||
(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 (sort-list contributionNumbers <)))
|
||||
)) authors)
|
||||
(lambda (a b) (< (cadr a) (cadr b))))
|
||||
(list)))
|
||||
|
||||
#(define-markup-command (print-songinfo layout props) ()
|
||||
@ -75,22 +77,20 @@
|
||||
(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)
|
||||
)
|
||||
|
||||
(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
|
||||
(join-present (list
|
||||
(render-contribution-group (numbered-contribution-prefix firstAuthorContributions prefixLookup) (map car authorDataSame))
|
||||
" "
|
||||
(render-partial-contribution-group prefixLookup authorDataOther)
|
||||
))))
|
||||
)
|
||||
|
||||
(define (join-present items joiner)
|
||||
(string-join (filter (lambda (item) (and (string? item) (not (string-null? (string-trim-both item))))) items) joiner)
|
||||
)
|
||||
) " ")))))
|
||||
|
||||
(define (poet-and-composer-from-authors authors)
|
||||
(if authors
|
||||
|
Loading…
x
Reference in New Issue
Block a user