Fix handling of 'alttitle' variable to support both strings and lists in csv

This commit is contained in:
žuk 2025-03-03 20:18:45 +04:00
parent a61becaf5e
commit 07b598db06

View File

@ -358,7 +358,7 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s
(songvars (cdr song)) (songvars (cdr song))
(page-number (number->string (assoc-get (assq-ref songvars 'label) labelPageTable))) (page-number (number->string (assoc-get (assq-ref songvars 'label) labelPageTable)))
(extractedheadervars (extract-and-check-vars-from-header (assq-ref songvars 'header) (extractedheadervars (extract-and-check-vars-from-header (assq-ref songvars 'header)
'(title starttext alttitle altalttitle categorytitle categories authors year_text year_melody year_translation year_composition infotext translation pronunciation copyright source))) '(title starttext alttitle categorytitle categories authors year_text year_melody year_translation year_composition infotext translation pronunciation copyright source)))
(headervar-or-empty (lambda (varsym) (headervar-or-empty (lambda (varsym)
(let ((extracted (assq-ref extractedheadervars varsym))) (let ((extracted (assq-ref extractedheadervars varsym)))
(if extracted extracted "")))) (if extracted extracted ""))))
@ -378,8 +378,11 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s
page-number page-number
(headervar-or-empty 'title) (headervar-or-empty 'title)
(headervar-or-empty 'starttext) (headervar-or-empty 'starttext)
(headervar-or-empty 'alttitle) (let ((alttitle-value (headervar-or-empty 'alttitle)))
(headervar-or-empty 'altalttitle) (if (list? alttitle-value)
(string-join alttitle-value ", ") ; Wenn eine Liste, dann zusammenfügen
alttitle-value)) ; Wenn kein Liste, den originalen Wert verwenden
(headervar-or-empty 'categorytitle) (headervar-or-empty 'categorytitle)
(headervar-or-empty 'categories) (headervar-or-empty 'categories)
(format-authors (append poetIds (map car versePoetData))) (format-authors (append poetIds (map car versePoetData)))
@ -404,7 +407,6 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s
"title" "title"
"starttext" "starttext"
"alttitle" "alttitle"
"altalttitle"
"categorytitle" "categorytitle"
"categories" "categories"
"poets" "poets"