multiple stanza numbers for one verse

This commit is contained in:
2025-08-09 13:27:38 +02:00
parent 8ce3af93c7
commit 9fb2d96765

View File

@@ -121,16 +121,18 @@ override-stanza =
#} #}
) )
stanza = #(define (stanza . stanzanumbers)
#(define-music-function (parser location stanzanumber) (number?)
#{ #{
\once \override StanzaNumber.layer = 23 % set this to signal that there is a real stanza and no repeat signs \once \override StanzaNumber.layer = 23 % set this to signal that there is a real stanza and no repeat signs
\applyContext \applyContext
#(lambda (context) #(lambda (context)
(let* ((stanzanumber (ly:assoc-get 'forced-spacing (ly:context-grob-definition context 'StanzaNumber) stanzanumber)) (let* ((stanzanumber-override (ly:assoc-get 'forced-spacing (ly:context-grob-definition context 'StanzaNumber) #f))
(stanzastyle (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber))) (stanza-style (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
(formattedStanzaNumber (format #f (if (eq? stanzastyle 'roman) romanStanzaFormat stanzaFormat) stanzanumber))) (stanza-format (lambda (stanzanumber) (format #f (if (eq? stanza-style 'roman) romanStanzaFormat stanzaFormat) stanzanumber))))
(ly:context-set-property! context 'stanza formattedStanzaNumber))) (ly:context-set-property! context 'stanza
(string-join (map stanza-format
(if stanzanumber-override (list stanzanumber-override) stanzanumbers))
", "))))
#} #}
) )