sort contributions
This commit is contained in:
parent
cc4fc9f297
commit
654f619fba
@ -21,11 +21,13 @@
|
|||||||
|
|
||||||
#(define (find-author-id-with-part-numbers contributionType authors)
|
#(define (find-author-id-with-part-numbers contributionType authors)
|
||||||
(if authors
|
(if authors
|
||||||
|
(sort-list
|
||||||
(filter-map (lambda (authordata)
|
(filter-map (lambda (authordata)
|
||||||
(let ((contributionNumbers (filter-map (lambda (contribution) (if (and (list? contribution) (equal? contributionType (car contribution))) (cadr contribution) #f)) (cdr authordata)))
|
(let ((contributionNumbers (filter-map (lambda (contribution) (if (and (list? contribution) (equal? contributionType (car contribution))) (cadr contribution) #f)) (cdr authordata)))
|
||||||
(authorId (car authordata)))
|
(authorId (car authordata)))
|
||||||
(if (null? contributionNumbers) #f (cons authorId contributionNumbers))
|
(if (null? contributionNumbers) #f (cons authorId (sort-list contributionNumbers <)))
|
||||||
)) authors)
|
)) authors)
|
||||||
|
(lambda (a b) (< (cadr a) (cadr b))))
|
||||||
(list)))
|
(list)))
|
||||||
|
|
||||||
#(define-markup-command (print-songinfo layout props) ()
|
#(define-markup-command (print-songinfo layout props) ()
|
||||||
@ -75,22 +77,20 @@
|
|||||||
(string-append contributionPrefix " " (string-join (format-authors 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)
|
||||||
|
)
|
||||||
|
|
||||||
(define (render-partial-contribution-group prefixLookup authorData)
|
(define (render-partial-contribution-group prefixLookup authorData)
|
||||||
(if (null? authorData)
|
(if (null? authorData)
|
||||||
""
|
""
|
||||||
(let ((firstAuthorContributions (cdar authorData)))
|
(let ((firstAuthorContributions (cdar authorData)))
|
||||||
(receive (authorDataSame authorDataOther)
|
(receive (authorDataSame authorDataOther)
|
||||||
(partition (lambda (authorEntry) (equal? (cdr authorEntry) firstAuthorContributions)) authorData)
|
(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-contribution-group (numbered-contribution-prefix firstAuthorContributions prefixLookup) (map car authorDataSame))
|
||||||
" "
|
|
||||||
(render-partial-contribution-group prefixLookup authorDataOther)
|
(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)
|
(define (poet-and-composer-from-authors authors)
|
||||||
(if authors
|
(if authors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user