Compare commits
5 Commits
b23ba5c0dc
...
e72efbd156
Author | SHA1 | Date | |
---|---|---|---|
e72efbd156 | |||
a0f60bc1c7 | |||
f5d5e1b020 | |||
4f43791541 | |||
2f906344de |
@ -1,7 +1,6 @@
|
|||||||
\language "deutsch"
|
\language "deutsch"
|
||||||
|
|
||||||
\include "default_style.ly"
|
\include "default_style.ly"
|
||||||
\include "default_author_style.ly"
|
|
||||||
\include "default_songinfo_style.ly"
|
\include "default_songinfo_style.ly"
|
||||||
\include "footer_with_songinfo.ly"
|
\include "footer_with_songinfo.ly"
|
||||||
|
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
\paper {
|
|
||||||
authorMarkup =
|
|
||||||
#(make-on-the-fly-markup
|
|
||||||
(lambda (layout props m)
|
|
||||||
(let ((name (chain-assoc-get 'author:name props #f))
|
|
||||||
(trail_name (chain-assoc-get 'author:trail_name props #f))
|
|
||||||
(birth_year (chain-assoc-get 'author:birth_year props #f))
|
|
||||||
(death_year (chain-assoc-get 'author:death_year props #f))
|
|
||||||
(organization (chain-assoc-get 'author:organization props #f))
|
|
||||||
(string-present (lambda (str) (and str (not (and (string? str) (string-null? str))))))
|
|
||||||
(render_informations (lambda (infolist) (string-append (car infolist) (if (null? (cdr infolist)) "" (string-append " (" (string-join (cdr infolist) ", ") ")")))))
|
|
||||||
)
|
|
||||||
(interpret-markup layout props
|
|
||||||
(if (or (string-present trail_name) (string-present name))
|
|
||||||
(render_informations (filter string-present (list
|
|
||||||
trail_name
|
|
||||||
name
|
|
||||||
(if (and (string-present birth_year) (string-present death_year))
|
|
||||||
(ly:format "~a‒~a" birth_year death_year)
|
|
||||||
(if (string-present birth_year)
|
|
||||||
(ly:format "*~a" birth_year)
|
|
||||||
(if (string-present death_year) (ly:format "†~a" death_year) "")))
|
|
||||||
organization
|
|
||||||
)))
|
|
||||||
""
|
|
||||||
))))
|
|
||||||
(make-null-markup)
|
|
||||||
)
|
|
||||||
poetMarkup = \markup { "Worte:" \fromproperty #'author }
|
|
||||||
composerMarkup = \markup { "Weise:" \fromproperty #'author }
|
|
||||||
poetAndComposerEqualMarkup = \markup { "Worte und Weise:" \fromproperty #'author }
|
|
||||||
}
|
|
@ -1,8 +1,31 @@
|
|||||||
\paper {
|
\paper {
|
||||||
|
poetPrefix = "Worte:"
|
||||||
|
composerPrefix = "Weise:"
|
||||||
|
compositionPrefix = "Satz:"
|
||||||
|
poetAndComposerEqualPrefix = "Worte und Weise:"
|
||||||
|
|
||||||
|
authorFormat =
|
||||||
|
#(lambda (noDetails name trail_name birth_year death_year organization)
|
||||||
|
(let ((string-present (lambda (str) (and str (not (and (string? str) (string-null? str))))))
|
||||||
|
(render_informations (lambda (infolist) (string-append (car infolist) (if (or noDetails (null? (cdr infolist))) "" (string-append " (" (string-join (cdr infolist) ", ") ")"))))))
|
||||||
|
(if (or (string-present trail_name) (string-present name))
|
||||||
|
(render_informations (filter string-present (list
|
||||||
|
trail_name
|
||||||
|
name
|
||||||
|
(if (and (string-present birth_year) (string-present death_year))
|
||||||
|
(ly:format "~a‒~a" birth_year death_year)
|
||||||
|
(if (string-present birth_year)
|
||||||
|
(ly:format "*~a" birth_year)
|
||||||
|
(if (string-present death_year) (ly:format "†~a" death_year) "")))
|
||||||
|
organization
|
||||||
|
)))
|
||||||
|
""
|
||||||
|
)))
|
||||||
|
|
||||||
songinfoMarkup =
|
songinfoMarkup =
|
||||||
#(make-on-the-fly-markup
|
#(make-on-the-fly-markup
|
||||||
(lambda (layout props m)
|
(lambda (layout props m)
|
||||||
(let ((between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
|
(let* ((between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
|
||||||
(poet-maybe-with-composer (chain-assoc-get 'songinfo:poet-maybe-with-composer props #f))
|
(poet-maybe-with-composer (chain-assoc-get 'songinfo:poet-maybe-with-composer props #f))
|
||||||
(composer (chain-assoc-get 'songinfo:composer props #f))
|
(composer (chain-assoc-get 'songinfo:composer props #f))
|
||||||
(copyright (chain-assoc-get 'songinfo:copyright props #f))
|
(copyright (chain-assoc-get 'songinfo:copyright props #f))
|
||||||
@ -10,16 +33,22 @@
|
|||||||
(translation (chain-assoc-get 'songinfo:translation props #f))
|
(translation (chain-assoc-get 'songinfo:translation props #f))
|
||||||
(pronunciation (chain-assoc-get 'songinfo:pronunciation props #f))
|
(pronunciation (chain-assoc-get 'songinfo:pronunciation props #f))
|
||||||
(year_text (chain-assoc-get 'songinfo:year_text props #f))
|
(year_text (chain-assoc-get 'songinfo:year_text props #f))
|
||||||
(year_melody (chain-assoc-get 'songinfo:year_melody props #f)))
|
(year_melody (chain-assoc-get 'songinfo:year_melody props #f))
|
||||||
|
(poet-with-year (if (and poet-maybe-with-composer year_text) (string-append poet-maybe-with-composer ", " year_text) poet-maybe-with-composer))
|
||||||
|
(composer-with-year (if (and composer year_melody) (string-append composer ", " year_melody) composer))
|
||||||
|
(poet-and-composer-oneliner (if (and poet-with-year composer-with-year) (markup poet-with-year between-poet-and-composer-markup composer-with-year) #f))
|
||||||
|
(current-line-width (chain-assoc-get 'line-width props (ly:output-def-lookup layout 'line-width))))
|
||||||
(stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props)
|
(stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props)
|
||||||
(interpret-markup-list layout props
|
(interpret-markup-list layout props
|
||||||
(append
|
(append
|
||||||
(make-wordwrap-internal-markup-list #t (list
|
(if (and poet-and-composer-oneliner (< (interval-length (ly:stencil-extent (interpret-markup layout props poet-and-composer-oneliner) X)) current-line-width))
|
||||||
(if poet-maybe-with-composer (markup
|
(list poet-and-composer-oneliner)
|
||||||
(if year_text (make-concat-markup (list poet-maybe-with-composer ", " year_text)) poet-maybe-with-composer) between-poet-and-composer-markup) "")
|
|
||||||
(if composer (if year_melody (make-concat-markup (list composer ", " year_melody)) composer) "")))
|
|
||||||
(make-wordwrap-string-internal-markup-list #t (string-append
|
(make-wordwrap-string-internal-markup-list #t (string-append
|
||||||
(if copyright (string-append "© " copyright) "")
|
(if poet-with-year (string-append "\n\n" poet-with-year) "")
|
||||||
|
(if composer-with-year (string-append "\n\n" composer-with-year) "")
|
||||||
|
)))
|
||||||
|
(make-wordwrap-string-internal-markup-list #t (string-append
|
||||||
|
(if copyright (string-append "\n\n© " copyright) "")
|
||||||
(if infotext (string-append "\n\n" infotext) "")
|
(if infotext (string-append "\n\n" infotext) "")
|
||||||
(if translation (string-append "\n\nÜbersetzung: " translation) "")
|
(if translation (string-append "\n\nÜbersetzung: " translation) "")
|
||||||
(if pronunciation (string-append "\n\nAussprache: " pronunciation) ""))))))))
|
(if pronunciation (string-append "\n\nAussprache: " pronunciation) ""))))))))
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
songFormatAndSize = "a4portrait"
|
songFormatAndSize = "a5"
|
||||||
songMargin = 5
|
songMargin = 5
|
||||||
songInfoFontSize = -3.5
|
songInfoFontSize = 0
|
||||||
songTitleFont = "LilyPond Sans"
|
songTitleFont = "LilyPond Sans"
|
||||||
songChordFont = "LilyPond Serif"
|
songChordFont = "LilyPond Sans"
|
||||||
songLyricFont = "LilyPond Sans"
|
songLyricFont = "LilyPond Sans"
|
||||||
songChordFontSeries = #'bold
|
songChordFontSeries = #'bold
|
||||||
songTextChordAlignment = #'center
|
songTextChordAlignment = #'left
|
||||||
songScoreChordFontSize = 0
|
songScoreChordFontSize = 2
|
||||||
songTextChordFontSize = \songScoreChordFontSize
|
songTextChordFontSize = \songScoreChordFontSize
|
||||||
songTextLineHeigth = 5
|
songTextLineHeigth = 5.3
|
||||||
songTocColumns = 3
|
songTocColumns = 3
|
||||||
globalSize = 15
|
globalSize = 15
|
||||||
lyricSize = 1.6
|
lyricSize = 1.6
|
||||||
|
@ -5,36 +5,89 @@
|
|||||||
(assoc-ref song key)
|
(assoc-ref song key)
|
||||||
(ly:warning (ly:format "song with id ~a not found" songId)))))
|
(ly:warning (ly:format "song with id ~a not found" songId)))))
|
||||||
|
|
||||||
(define (format-author authorId)
|
(define (format-author authorId noDetails)
|
||||||
(let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f)))
|
(let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f)))
|
||||||
(if author
|
(if author
|
||||||
(markup
|
((ly:output-def-lookup layout 'authorFormat)
|
||||||
#:override (cons 'author:name (assoc-ref author "name"))
|
noDetails
|
||||||
#:override (cons 'author:trail_name (assoc-ref author "trail_name"))
|
(assoc-ref author "name")
|
||||||
#:override (cons 'author:birth_year (assoc-ref author "birth_year"))
|
(assoc-ref author "trail_name")
|
||||||
#:override (cons 'author:death_year (assoc-ref author "death_year"))
|
(assoc-ref author "birth_year")
|
||||||
#:override (cons 'author:organization (assoc-ref author "organization"))
|
(assoc-ref author "death_year")
|
||||||
(ly:output-def-lookup layout 'authorMarkup))
|
(assoc-ref author "organization")
|
||||||
|
)
|
||||||
(ly:warning (ly:format "author with id ~a not found" authorId)))))
|
(ly:warning (ly:format "author with id ~a not found" authorId)))))
|
||||||
|
|
||||||
(define (format-poet poetId)
|
(define (format-poet poetId)
|
||||||
(markup #:override (cons 'author (format-author poetId)) (ly:output-def-lookup layout 'poetMarkup)))
|
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (format-author poetId #f)))
|
||||||
|
|
||||||
(define (format-composer composerId)
|
(define (format-composer composerId)
|
||||||
(markup #:override (cons 'author (format-author composerId)) (ly:output-def-lookup layout 'composerMarkup)))
|
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (format-author composerId #f)))
|
||||||
|
|
||||||
(define (format-poet-and-composer authorId)
|
(define (format-poet-and-composer authorId)
|
||||||
(markup #:override (cons 'author (format-author authorId)) (ly:output-def-lookup layout 'poetAndComposerEqualMarkup)))
|
(string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (format-author authorId #f)))
|
||||||
|
|
||||||
|
(define (find-author-ids-by contributionType authors)
|
||||||
|
(filter-map (lambda (authordata) (if (member contributionType (cdr authordata)) (car authordata) #f)) authors)
|
||||||
|
)
|
||||||
|
|
||||||
|
(define (find-author-id-with-part-numbers contributionType authors)
|
||||||
|
(filter-map (lambda (authordata)
|
||||||
|
(let ((contributionNumbers (filter-map (lambda (contribution) (if (and (list? contribution) (equal? contributionType (car contribution))) (cadr contribution) #f)) (cdr authordata)))
|
||||||
|
(authorId (car authordata)))
|
||||||
|
(if (null? contributionNumbers) #f (cons authorId contributionNumbers))
|
||||||
|
)) authors)
|
||||||
|
)
|
||||||
|
|
||||||
|
(define (render-contribution-numbers contributionNumbers)
|
||||||
|
(string-join (map (lambda (contributionNumber) (ly:format "~a." contributionNumber)) contributionNumbers) ", ")
|
||||||
|
)
|
||||||
|
(define (render-verse-contribution contributionNumbers)
|
||||||
|
(string-append (render-contribution-numbers contributionNumbers) " Strophe: ")
|
||||||
|
)
|
||||||
|
|
||||||
|
(define (render-voice-contribution contributionNumbers)
|
||||||
|
(string-append (render-contribution-numbers contributionNumbers) " Stimme: ")
|
||||||
|
)
|
||||||
|
|
||||||
|
(define (poet-and-composer-from-authors authors)
|
||||||
|
(if authors
|
||||||
|
(let* (
|
||||||
|
(poetIds (find-author-ids-by 'text authors))
|
||||||
|
(versePoetData (find-author-id-with-part-numbers 'verse authors))
|
||||||
|
(allPoetIds (append poetIds (map car versePoetData)))
|
||||||
|
(composerIds (find-author-ids-by 'melody authors))
|
||||||
|
(compositionIds (find-author-ids-by 'composition authors))
|
||||||
|
(voiceComposerData (find-author-id-with-part-numbers 'voice authors))
|
||||||
|
(poets (append
|
||||||
|
(map (lambda (poetId) (format-author poetId #f)) poetIds)
|
||||||
|
(map (lambda (versePoetEntry) (string-append (render-verse-contribution (cdr versePoetEntry)) (format-author (car versePoetEntry) (member (car versePoetEntry) poetIds)))) versePoetData)
|
||||||
|
))
|
||||||
|
(composers (append
|
||||||
|
(map (lambda (composerId) (format-author composerId (member composerId allPoetIds))) composerIds)
|
||||||
|
(map (lambda (composerId) (string-append (ly:output-def-lookup layout 'compositionPrefix) " " (format-author composerId (member composerId allPoetIds)))) compositionIds)
|
||||||
|
(map (lambda (voiceComposerEntry) (string-append (render-voice-contribution (cdr voiceComposerEntry)) (format-author (car voiceComposerEntry) (member (car voiceComposerEntry) allPoetIds)))) voiceComposerData)
|
||||||
|
)))
|
||||||
|
(if (and (equal? poetIds composerIds) (null? versePoetData) (null? voiceComposerData) (null? compositionIds))
|
||||||
|
(list (string-append (ly:output-def-lookup layout 'poetAndComposerEqualPrefix) " " (string-join poets ", ")) #f)
|
||||||
|
(list
|
||||||
|
(string-append (ly:output-def-lookup layout 'poetPrefix) " " (string-join poets ", "))
|
||||||
|
(string-append (ly:output-def-lookup layout 'composerPrefix) " " (string-join composers ", ")))))
|
||||||
|
(list #f #f)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(interpret-markup layout props
|
(interpret-markup layout props
|
||||||
(if (chain-assoc-get 'page:is-bookpart-last-page props #f)
|
(if (chain-assoc-get 'page:is-bookpart-last-page props #f)
|
||||||
(let* ((songId (chain-assoc-get 'header:songId props #f))
|
(let* ((authors (chain-assoc-get 'header:authors props #f))
|
||||||
|
(poet-and-composers (poet-and-composer-from-authors authors))
|
||||||
|
(songId (chain-assoc-get 'header:songId props #f))
|
||||||
(poetId (chain-assoc-get 'header:poetId props (if songId (songinfo-from songId "poet") #f)))
|
(poetId (chain-assoc-get 'header:poetId props (if songId (songinfo-from songId "poet") #f)))
|
||||||
(composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f)))
|
(composerId (chain-assoc-get 'header:composerId props (if songId (songinfo-from songId "composer") #f)))
|
||||||
(poet-and-composer-same (equal? poetId composerId)))
|
(poet-and-composer-same (equal? poetId composerId)))
|
||||||
(let ((infotext (chain-assoc-get 'header:infotext props (chain-assoc-get 'header:songinfo props #f)))
|
(let ((infotext (chain-assoc-get 'header:infotext props (chain-assoc-get 'header:songinfo props #f)))
|
||||||
(poet-maybe-with-composer (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f)))
|
(poet-maybe-with-composer (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) (car poet-and-composers))))
|
||||||
(composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) #f)))
|
(composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) (cadr poet-and-composers))))
|
||||||
(copyright (chain-assoc-get 'header:copyright props #f))
|
(copyright (chain-assoc-get 'header:copyright props #f))
|
||||||
(translation (chain-assoc-get 'header:translation props #f))
|
(translation (chain-assoc-get 'header:translation props #f))
|
||||||
(pronunciation (chain-assoc-get 'header:pronunciation props #f))
|
(pronunciation (chain-assoc-get 'header:pronunciation props #f))
|
||||||
|
@ -114,7 +114,16 @@
|
|||||||
(make-custom-linebreaks
|
(make-custom-linebreaks
|
||||||
(cdr break-words)
|
(cdr break-words)
|
||||||
(ly:regex-replace
|
(ly:regex-replace
|
||||||
(ly:make-regex (string-append "(" (ly:regex-replace (ly:make-regex "(.)") (car break-words) "(?:\\(?" 1 "| *,[^,)]+\\)" 1 ")") "(?: *,[^,)]+\\))?)(.*)$"))
|
(ly:make-regex
|
||||||
|
(string-append
|
||||||
|
"("
|
||||||
|
(string-concatenate
|
||||||
|
(map
|
||||||
|
(lambda (character)
|
||||||
|
(let ((escaped_char (ly:regex-quote (string character))))
|
||||||
|
(string-append "(?: *,[^,)]+\\)" escaped_char "|\\(?" escaped_char ")")))
|
||||||
|
(string->list (car break-words))))
|
||||||
|
"(?: *,[^,)]+\\))?)(.*)$"))
|
||||||
newtext
|
newtext
|
||||||
1 "\n" 2))))))
|
1 "\n" 2))))))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user