Strophensortierung gefixt

This commit is contained in:
tux 2023-09-25 01:39:55 +02:00
parent 15f37accaa
commit 33c3d47504

View File

@ -142,26 +142,25 @@
(verse-hspace 1) (verse-hspace 1)
(verse-ordering-horizontal #f)) (verse-ordering-horizontal #f))
"Gruppiere Strophen in einem Markup auf Wunsch spaltenweise" "Gruppiere Strophen in einem Markup auf Wunsch spaltenweise"
(let ((h (make-hash-table verse-cols)) (define (add-markup-between-elements reverses markup-between elements)
(index 0) ((if reverses fold fold-right) (lambda (element filled-list)
(column-item-count (ceiling (/ (length versegroup) verse-cols)))) (cons element (if (null? filled-list) '() (cons markup-between filled-list))))
(for-each (lambda (el) '() elements))
(let ((i (if verse-ordering-horizontal (let* ((column-item-count (ceiling (/ (length versegroup) verse-cols)))
(modulo index verse-cols) (column-data (make-list verse-cols)))
(floor (/ index column-item-count))))) (let columnize-list ((index 0) (items versegroup))
(hashv-set! h i (cons el (hashv-ref h i (list)))) (set! index (+ index 1)))) (if (not (null? items))
versegroup) (let* ((column-index (if verse-ordering-horizontal
(interpret-markup layout props (modulo index verse-cols)
(make-fill-line-markup (cons (make-verseformat-markup (make-line-markup (floor (/ index column-item-count))))
(reverse (hash-fold (lambda (key value l) (column-markups (list-ref column-data column-index)))
(cons (make-column-markup (list-set! column-data column-index (cons (car items) column-markups))
(fold (lambda (v verses) (columnize-list (+ index 1) (cdr items)))))
(cons v (if (null? verses) (interpret-markup layout props
verses (make-fill-line-markup (list (make-verseformat-markup (make-line-markup
(cons (make-vspace-markup verse-vspace) verses)))) (add-markup-between-elements #f
(list) value)) (make-hspace-markup verse-hspace)
(if (null-list? l) (map (lambda (column-markups)
l (make-column-markup
(cons (make-hspace-markup verse-hspace) l)))) (add-markup-between-elements #t (make-vspace-markup verse-vspace) column-markups)))
(list) h)))) column-data)))))))))
(list))))))