Compare commits

...

2 Commits

3 changed files with 37 additions and 18 deletions

View File

@ -94,14 +94,6 @@ generalLayout = \layout {
}
}
verseChordLayout = \layout {
\generalLayout
\context {
\ChordNames
\override ChordName.font-size = \songTextChordFontSize
}
}
% Akkord mit Bunddiagramm anzeigen
#(define-markup-command (fret-chord layout props fret chord) (string? string?)
(interpret-markup layout props

View File

@ -3,6 +3,15 @@
MUSIC = { \transposable \MUSIC }
verselayout = \layout {
\LAYOUT
\context {
\ChordNames
\override ChordName.font-size = \songTextChordFontSize
}
}
TEXT = \markuplist { \override #`(verselayout . verselayout) \TEXT }
% nur Output wenn noStandaloneOutput auf false steht
output = #(if (not noStandaloneOutput)
#{

View File

@ -66,17 +66,18 @@
% Text über Text mittig darstellen
#(define-markup-command (textup layout props text uptext) (markup? markup?)
"Markup über Text mittig darstellen."
(let ((verselayout (chain-assoc-get 'verselayout props generalLayout)))
(interpret-markup layout props
#{\markup {
\size-box-to-box-style-dependent ##t ##f
\general-align #X #LEFT \override #`(direction . ,UP) \override #'(baseline-skip . 1.0) \dir-column \chord-alignment-style-dependent {
\pad-to-box #'(0 . 0) #'(0 . 2.0) { #text }
\size-box-to-box ##f ##t #uptext \score { \chords { g4:m a } \layout { \generalLayout } }
\size-box-to-box ##f ##t #uptext \score { \chords { g4:m a } \layout { \verselayout } }
}
#text
}
#}
))
)))
#(define-markup-command (anchor-x-between layout props arga argb)
(markup? markup?)
@ -88,43 +89,60 @@
#(define-markup-command (stanza-raw layout props arg)
(markup?)
(let ((verselayout (chain-assoc-get 'verselayout props generalLayout)))
(interpret-markup layout props
(if (and (string? arg) (string-null? arg))
" "
#{\markup
\score { \new Lyrics { \lyricmode { \set stanza = #arg "" } } \layout { \generalLayout } }
\score { \new Lyrics { \lyricmode { \set stanza = #arg "" } } \layout { \verselayout } }
#}
)))
))))
#(define-markup-command (stanza layout props arg)
(markup?)
(interpret-markup layout props
(make-size-box-to-box-markup #f #t (make-stanza-raw-markup arg) (make-stanza-raw-markup "x"))))
#(define (handle-custom-newlines custom-verse-breaks text)
(if (null? custom-verse-breaks)
text
(let make-custom-linebreaks
((break-words custom-verse-breaks)
(newtext (ly:regex-replace (ly:make-regex "\n") text " ")))
(if (null? break-words)
newtext
(make-custom-linebreaks
(cdr break-words)
(ly:regex-replace
(ly:make-regex (string-append "(" (ly:regex-replace (ly:make-regex "(.)") (car break-words) "(?:\\(?" 1 "| *,[^,)]+\\)" 1 ")") "(?: *,[^,)]+\\))?)(.*)$"))
newtext
1 "\n" 2))))))
% Kompletten Vers mit Akkorden
#(define-markup-command (chordverse layout props stanza verse) (markup? string?)
#:properties ((intraverse-vspace 0))
#:properties ((intraverse-vspace 0)(custom-verse-breaks '()))
"Vers mit Akkorden"
(let* ((fromto (chain-assoc-get 'transposition props #f))
(transp (if fromto
(string-append "\\transpose " (car fromto) " " (cdr fromto))
"")))
""))
(verselayout (chain-assoc-get 'verselayout props generalLayout)))
(interpret-markup layout props
(markup #:override `(baseline-skip . ,(+ intraverse-vspace songTextLineHeigth)) #:anchor-x-between #:stanza stanza
(make-wrap-newline-markup
(ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)")
(ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") verse " \\concat { " 1 " } ")
"\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }")
(ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") (handle-custom-newlines custom-verse-breaks verse) " \\concat { " 1 " } ")
"\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verselayout } }")
)
))))
% Kompletter Vers aus dem Akkorde entfernt werden
#(define-markup-command (nochordverse layout props stanza verse) (markup? string?)
#:properties ((intraverse-vspace 0))
#:properties ((intraverse-vspace 0)(custom-verse-breaks '()))
"Vers ohne Akkorde"
(interpret-markup layout props
(markup #:override `(baseline-skip . ,(+ intraverse-vspace 3.0)) #:anchor-x-between #:stanza stanza
#:wrap-newline (ly:regex-replace (ly:make-regex "\\(([^,]*),([^)]*)\\)") verse 1)
#:wrap-newline (ly:regex-replace (ly:make-regex "\\(([^,]*),([^)]*)\\)") (handle-custom-newlines custom-verse-breaks verse) 1)
)
)
)