20 Commits

Author SHA1 Message Date
tux
e72efbd156 custom line breaks more robust refs #21 2024-02-04 16:29:10 +01:00
tux
a0f60bc1c7 Autorensystem erweitert mit Angaben von Teilbeiträgen 2024-01-03 22:31:59 +01:00
tux
f5d5e1b020 neues System für Autorenangaben 2023-12-30 20:14:31 +01:00
4f43791541 Styleanpassungen Default style 2023-12-24 00:05:33 +01:00
2f906344de fix custom line break issue with comma 2023-11-23 10:24:06 +01:00
tux
b23ba5c0dc Aussprache ist natürlich pronunciation 2023-11-22 18:36:59 +01:00
tux
bc769f0831 gibt nur noch default style, alles andere in Liederbuchrepos 2023-11-22 17:33:02 +01:00
tux
6975cb1713 einheitliche ref und stanza Formatierung 2023-11-22 16:48:44 +01:00
tux
fbaf7a2c86 drop lilypond pre 2.25.8 compatibility, cause its not working anyway 2023-11-22 15:28:31 +01:00
tux
8b0fc2d7c9 snippets einzeln baubar und default layout 2023-11-02 23:13:11 +01:00
14e01900c2 songinfo Ausrichtung einfacher anpassbar gemacht 2023-11-01 09:48:52 +01:00
tux
bf596edb2c songinfogenerierung optimiert 2023-10-31 18:48:15 +01:00
tux
d6774670f3 Songinfogenerierung verbessert 2023-10-31 13:31:50 +01:00
tux
260664462d fix custom verse breaks for windows 2023-10-30 23:24:18 +01:00
tux
9de2869750 erlaube Umbrüche in Versen nach angegebenen Texten 2023-10-29 22:54:10 +01:00
tux
f0010c7746 Layoutmodifikationen auch für Strophen nutzen 2023-10-29 16:25:15 +01:00
tux
bedb2c0e22 fix chord name font 2023-10-28 09:34:26 +02:00
tux
33c3d47504 Strophensortierung gefixt 2023-09-25 01:39:55 +02:00
tux
15f37accaa repeats around chords 2023-09-18 18:08:33 +02:00
tux
c26fddd963 Inhaltsverzeichniserzeugung refactored 2023-09-17 18:08:52 +02:00
21 changed files with 331 additions and 332 deletions

20
all_base_includes.ly Normal file
View File

@ -0,0 +1,20 @@
#(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f))
#(if (defined? 'LAYOUT) #f (load "json_parser.scm"))
#(use-modules (json parser))
\include "basic_format_and_style_settings.ly"
\include "eps_file_from_song_dir.ly"
\include "title_with_category_images.ly"
\include "auto_rest_merging.ly"
\include "chord_settings.ly"
\include "transposition.ly"
\include "verses_with_chords.ly"
\include "arrows_in_scores.ly"
\include "swing_style.ly"
\include "inline_score.ly"
% reset important variables
LAYOUT = \layout { \generalLayout }
HEADER = {}
MUSIC = {}
TEXT = \markuplist {""}

View File

@ -1,8 +1,8 @@
\language "deutsch" \language "deutsch"
\include "default_author_style.ly" \include "default_style.ly"
\include "styles.ly" \include "default_songinfo_style.ly"
\include #(ly:format "styles/~a.ly" songStyle) \include "footer_with_songinfo.ly"
\include #(if (defined? 'customStyleOverridesFile) customStyleOverridesFile "void.ly") \include #(if (defined? 'customStyleOverridesFile) customStyleOverridesFile "void.ly")
@ -93,6 +93,8 @@ schwarzkopf =
\override NoteHead.color = #grey \override NoteHead.color = #grey
#}) #})
% hübsche Wiederholungszeichen für den Liedtext stanza =
repStart = "𝄆" #(define-music-function (parser location stanzanumber) (number?)
repStop = "𝄇" #{ \set stanza = #(ly:format stanzaFormat stanzanumber) #})
ref = { \set stanza = \refString }

View File

@ -1,5 +1,3 @@
\version "2.18"
#(define song-list '()) #(define song-list '())
#(define (files-in-directory dirname) #(define (files-in-directory dirname)
@ -120,7 +118,7 @@ includeSong =
#{ #{
\bookOutputName #filename \bookOutputName #filename
#} #}
(ly:parser-parse-string (if (< (list-ref (ly:version) 1) 19) (ly:parser-clone parser) (ly:parser-clone)) (ly:parser-parse-string (ly:parser-clone)
(ly:format "\\include \"~a/~a/~a.ly\"" songPath filename filename)) (ly:format "\\include \"~a/~a/~a.ly\"" songPath filename filename))
(let ((label (gensym "index"))) (let ((label (gensym "index")))
(set! additional-page-switch-label-list (set! additional-page-switch-label-list
@ -155,7 +153,7 @@ imagepage =
songs = songs =
#(define-void-function (parser location) () #(define-void-function (parser location) ()
(for-each (lambda (songitems) (for-each (lambda (songitems)
(ly:book-add-bookpart! (if (< (list-ref (ly:version) 1) 19) (ly:parser-lookup parser '$current-book) (ly:parser-lookup '$current-book)) (ly:book-add-bookpart! (ly:parser-lookup '$current-book)
(let ((filename (car songitems)) (let ((filename (car songitems))
(songvars (cdr songitems))) (songvars (cdr songitems)))
(if (eq? filename 'emptyPage) (if (eq? filename 'emptyPage)

View File

@ -8,6 +8,16 @@ klamm = #(define-music-function (parser location chords) (ly:music?)
\set chordNameFunction = #ignatzek-chord-names \set chordNameFunction = #ignatzek-chord-names
#}) #})
repeats-around-chords =
#(define-music-function (parser location chords) (ly:music?)
#{
\once \set noChordSymbol = \markup { \normal-text \repStart }
r4
$chords
\once \set noChordSymbol = \markup { \normal-text \repStop }
r4
#})
bchord = bchord =
#(define-music-function (parser location chords) (ly:music?) #(define-music-function (parser location chords) (ly:music?)
#{ #{
@ -71,7 +81,7 @@ generalLayout = \layout {
\semiGermanChords \semiGermanChords
\override ChordName.font-size = \songScoreChordFontSize \override ChordName.font-size = \songScoreChordFontSize
\override ChordName.font-series = \songChordFontSeries \override ChordName.font-series = \songChordFontSeries
\override ChordName.font-family = #'sans \override ChordName.font-family = #'serif
chordNameLowercaseMinor = ##t chordNameLowercaseMinor = ##t
chordChanges = ##t chordChanges = ##t
% eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben) % eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben)
@ -84,25 +94,15 @@ generalLayout = \layout {
} }
} }
verseChordLayout = \layout {
\generalLayout
\context {
\ChordNames
\override ChordName.font-size = \songTextChordFontSize
}
}
% Akkord mit Bunddiagramm anzeigen % Akkord mit Bunddiagramm anzeigen
#(define-markup-command (fret-chord layout props fret chord) (string? string?) #(define-markup-command (fret-chord layout props fret chord) (string? string?)
(interpret-markup layout props (interpret-markup layout props
#{ \markup { \override #'(baseline-skip . 2) #{ \markup { \override #'(baseline-skip . 2)
\center-column { \center-column {
\score { \new ChordNames { #(if (< (list-ref (ly:version) 1) 19) \score { \new ChordNames {
(ly:parser-include-string parser (string-append "\\chordmode { s4 " chord " }")) #(ly:parser-include-string (string-append "\\chordmode { s4 " chord " }"))
(ly:parser-include-string (string-append "\\chordmode { s4 " chord " }")) } \layout { \generalLayout } }
) } \layout { \generalLayout } } \override #'(fret-diagram-details . ((barre-type . straight))) {
\override #'(fret-diagram-details . (
(barre-type . straight))) {
\fret-diagram-terse #fret \fret-diagram-terse #fret
} }
} }

View File

@ -1,26 +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)))
(interpret-markup layout props
(string-append
name
(if trail_name (ly:format " (~a)" trail_name) "")
(if (and birth_year death_year)
(ly:format ", (~a~a)" birth_year death_year)
(if birth_year
(ly:format ", (*~a)" birth_year)
(if death_year (ly:format ", (†~a)" death_year) "")))
(if organization (ly:format ", ~a" organization) "")
))))
(make-null-markup)
)
poetMarkup = \markup { "Worte:" \fromproperty #'author }
composerMarkup = \markup { "Weise:" \fromproperty #'author }
poetAndComposerEqualMarkup = \markup { "Worte und Weise:" \fromproperty #'author }
}

7
default_output.ly Normal file
View File

@ -0,0 +1,7 @@
#(define noDefaultOutput (if (defined? 'noDefaultOutput) noDefaultOutput #f))
HEADER = \bookpart {
\header {
\basicSongInfo
}
}
\include #(if noDefaultOutput "void.ly" "standalone_output.ly")

57
default_songinfo_style.ly Normal file
View File

@ -0,0 +1,57 @@
\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 =
#(make-on-the-fly-markup
(lambda (layout props m)
(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))
(composer (chain-assoc-get 'songinfo:composer props #f))
(copyright (chain-assoc-get 'songinfo:copyright props #f))
(infotext (chain-assoc-get 'songinfo:infotext props #f))
(translation (chain-assoc-get 'songinfo:translation props #f))
(pronunciation (chain-assoc-get 'songinfo:pronunciation props #f))
(year_text (chain-assoc-get 'songinfo:year_text 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)
(interpret-markup-list layout props
(append
(if (and poet-and-composer-oneliner (< (interval-length (ly:stencil-extent (interpret-markup layout props poet-and-composer-oneliner) X)) current-line-width))
(list poet-and-composer-oneliner)
(make-wordwrap-string-internal-markup-list #t (string-append
(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 translation (string-append "\n\nÜbersetzung: " translation) "")
(if pronunciation (string-append "\n\nAussprache: " pronunciation) ""))))))))
(make-null-markup)
)
}

19
default_style.ly Normal file
View File

@ -0,0 +1,19 @@
songFormatAndSize = "a5"
songMargin = 5
songInfoFontSize = 0
songTitleFont = "LilyPond Sans"
songChordFont = "LilyPond Sans"
songLyricFont = "LilyPond Sans"
songChordFontSeries = #'bold
songTextChordAlignment = #'left
songScoreChordFontSize = 2
songTextChordFontSize = \songScoreChordFontSize
songTextLineHeigth = 5.3
songTocColumns = 3
globalSize = 15
lyricSize = 1.6
stanzaFormat = "~a."
refString = "Ref.:"
% hübsche Wiederholungszeichen für den Liedtext
repStart = "𝄆"
repStop = "𝄇"

View File

@ -5,60 +5,116 @@
(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 ( (let ((infotext (chain-assoc-get 'header:infotext props (chain-assoc-get 'header:songinfo props #f)))
(blockwidth (* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width))) (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))))
(infotext (chain-assoc-get 'header:songinfo props #f)) (composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) (cadr poet-and-composers))))
(poet (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f))) (copyright (chain-assoc-get 'header:copyright props #f))
(composer (chain-assoc-get 'header:composer props (if (and composerId (not poet-and-composer-same)) (format-composer composerId) #f))) (translation (chain-assoc-get 'header:translation props #f))
(poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked)) (pronunciation (chain-assoc-get 'header:pronunciation props #f))
(between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3))) (year_text (chain-assoc-get 'header:year_text props #f))
(copyright (chain-assoc-get 'header:copyright props #f))) (year_melody (chain-assoc-get 'header:year_melody props #f)))
(markup #:override '(baseline-skip . 3.0) ( (markup
make-fontsize-markup songInfoFontSize #:override (cons 'songinfo:poet-maybe-with-composer
(make-sans-markup (if (and poet-maybe-with-composer (not (and (string? poet-maybe-with-composer) (string-null? poet-maybe-with-composer)))) poet-maybe-with-composer #f))
;%\override #'(line-width . 92) \wordwrap-field #symbol #:override (cons 'songinfo:composer
(make-column-markup (list (if (and composer (not (and (string? composer) (string-null? composer)))) composer #f))
(make-line-markup #:override (cons 'songinfo:copyright
(list (if (and copyright (not (and (string? copyright) (string-null? copyright)))) copyright #f))
(if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "") #:override (cons 'songinfo:infotext
(if (and composer (not poet-and-composer-stacked)) composer "")) (if (and infotext (not (and (string? infotext) (string-null? infotext)))) infotext #f))
) #:override (cons 'songinfo:translation
(if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "") (if (and translation (not (and (string? translation) (string-null? translation)))) translation #f))
(make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append #:override (cons 'songinfo:pronunciation
(if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "") (if (and pronunciation (not (and (string? pronunciation) (string-null? pronunciation)))) pronunciation #f))
(if infotext infotext "") #:override (cons 'songinfo:year_text
(if (and year_text (not (and (string? year_text) (string-null? year_text)))) year_text #f))
#:override (cons 'songinfo:year_melody
(if (and year_melody (not (and (string? year_melody) (string-null? year_melody)))) year_melody #f))
#:override '(baseline-skip . 3.0)
#:fontsize songInfoFontSize
#:sans
(ly:output-def-lookup layout 'songinfoMarkup)
))) )))
)))
)
)
))
(make-null-markup))) (make-null-markup)))
) )
@ -72,6 +128,12 @@
) )
)))) ))))
#(define-markup-command (fractional-line-width layout props arg)(markup?)
(interpret-markup layout props
(make-override-markup
`(line-width . ,(* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width)))
arg)))
\paper { \paper {
print-first-page-number = ##t print-first-page-number = ##t
first-page-number = #0 first-page-number = #0
@ -79,14 +141,14 @@
oddFooterMarkup = \markup { oddFooterMarkup = \markup {
\fill-line { \fill-line {
\line { \null } \line { \null }
\line { \general-align #Y #DOWN \print-songinfo } \line { \general-align #Y #DOWN \fractional-line-width \print-songinfo }
\line { \if \should-print-page-number \print-pagenumber } \line { \if \should-print-page-number \print-pagenumber }
} }
} }
evenFooterMarkup = \markup { evenFooterMarkup = \markup {
\fill-line { \fill-line {
\line { \if \should-print-page-number \print-pagenumber } \line { \if \should-print-page-number \print-pagenumber }
\line { \general-align #Y #DOWN \print-songinfo } \line { \general-align #Y #DOWN \fractional-line-width \print-songinfo }
\line { \null } \line { \null }
} }
} }

View File

@ -1,28 +1,6 @@
\version "2.18" \version "2.25.8"
#(ly:set-option 'relative-includes #t) #(ly:set-option 'relative-includes #t)
\include #(if (< (list-ref (ly:version) 1) 24) "legacy-lilypond-compatibility.ly" "void.ly") #(define noDefaultOutput #t)
#(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f)) \include "all_base_includes.ly"
#(if (defined? 'LAYOUT) #f (load "json_parser.scm"))
#(use-modules (json parser))
\include "basic_format_and_style_settings.ly"
\include #(if (< (list-ref (ly:version) 1) 25) "legacy-lilypond-compatibility-pre-2.25.ly" "void.ly")
\include "eps_file_from_song_dir.ly"
\include "title_with_category_images.ly"
\include "footer_with_songinfo.ly"
\include "auto_rest_merging.ly"
\include "chord_settings.ly"
\include "transposition.ly"
\include "verses_with_chords.ly"
\include "arrows_in_scores.ly"
\include "swing_style.ly"
\include "inline_score.ly"
% reset important variables
LAYOUT = \layout { \generalLayout }
HEADER = {}
MUSIC = {}
TEXT = \markuplist {""}

View File

@ -1,22 +0,0 @@
% guile regular expressions aktivieren:
#(use-modules (ice-9 regex))
#(define ly:make-regex make-regexp)
#(define ly:regex-exec regexp-exec)
#(define ly:regex-match-substring match:substring)
#(define (ly:regex-replace pattern text . replacements)
(apply regexp-substitute/global #f pattern text 'pre (append replacements (list 'post))))
% old font handling
#(define (default-pango size)
(make-pango-font-tree
songChordFont
songLyricFont
"Luxi Mono"
(/ size 20)))
\paper {
#(define fonts (default-pango globalSize))
}

View File

@ -1,27 +0,0 @@
% this is to be compatible to older lilypond versions
\version "2.18.0"
#(define (on-first-page layout props)
"Whether the markup is printed on the first page of the book."
(= (chain-assoc-get 'page:page-number props -1)
(book-first-page layout props)))
#(define-markup-command (if layout props condition? argument)
(procedure? markup?)
#:category conditionals
(if (condition? layout props)
(interpret-markup layout props argument)
empty-stencil))
#(define (on-first-page-of-part layout props)
"Whether the markup is printed on the first page of the book part."
(= (chain-assoc-get 'page:page-number props -1)
(ly:output-def-lookup layout 'first-page-number)))
#(define (should-print-page-number layout props)
"Whether the page number should be printed on this page. This depends
on the settings @code{print-@/page-@/numbers} and
@code{print-@/first-@/page-@/number} of the @code{\\paper} block."
(and (eq? #t (ly:output-def-lookup layout 'print-page-number))
(or (not (on-first-page layout props))
(eq? #t (ly:output-def-lookup layout 'print-first-page-number)))))

8
snippet_include.ly Normal file
View File

@ -0,0 +1,8 @@
#(ly:set-option 'relative-includes #t)
#(define noDefaultOutput (if (defined? 'noDefaultOutput) noDefaultOutput #f))
\include #(if noDefaultOutput "void.ly" "all_base_includes.ly")
#(define AUTHOR_DATA (if (defined? 'AUTHOR_DATA) AUTHOR_DATA (call-with-input-file "../data/authors.json" json->scm)))
#(define SONG_DATA (if (defined? 'SONG_DATA) SONG_DATA (call-with-input-file "../data/songs.json" json->scm)))

View File

@ -3,6 +3,15 @@
MUSIC = { \transposable \MUSIC } 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 % nur Output wenn noStandaloneOutput auf false steht
output = #(if (not noStandaloneOutput) output = #(if (not noStandaloneOutput)
#{ #{

View File

@ -5,7 +5,7 @@
#(define songStyle #(define songStyle
(if (not (defined? 'songStyle)) (if (not (defined? 'songStyle))
(if (not (defined? 'defaultSongStyle)) 'börnel defaultSongStyle) (if (not (defined? 'defaultSongStyle)) 'default defaultSongStyle)
songStyle)) songStyle))
#(if (not (boolean? bookStyle)) #(if (not (boolean? bookStyle))

View File

@ -1,15 +0,0 @@
songFormatAndSize = "a6landscape"
songMargin = 8
songInfoFontSize = -1.5
songTitleFont = "Britannic T. custom"
songChordFont = "TimesNewRomanPS"
songLyricFont = "Arial"
songChordFontSeries = #'normal
songTextChordAlignment = #'left
songScoreChordFontSize = 3
songTextChordFontSize = 2
songTextLineHeigth = 5.5
songInfoPoetAndComposerStacked = ##f
songTocColumns = 3
globalSize = 15
lyricSize = 1.6

View File

@ -1,15 +0,0 @@
songFormatAndSize = "b6landscape"
songMargin = 5
songInfoFontSize = -3.5
songTitleFont = "Oregano"
songChordFont = "TeX Gyre Heros"
songLyricFont = "Liberation Sans"
songChordFontSeries = #'bold
songTextChordAlignment = #'center
songScoreChordFontSize = 0
songTextChordFontSize = \songScoreChordFontSize
songTextLineHeigth = 5
songInfoPoetAndComposerStacked = ##f
songTocColumns = 3
globalSize = 15
lyricSize = 1.6

View File

@ -1,15 +0,0 @@
songFormatAndSize = "a5"
songMargin = 5
songInfoFontSize = 0
songTitleFont = "Fontin Bold"
songChordFont = "Fontin"
songLyricFont = "FontinSans"
songChordFontSeries = #'bold
songTextChordAlignment = #'left
songScoreChordFontSize = 2
songTextChordFontSize = 2
songTextLineHeigth = 5.3
songInfoPoetAndComposerStacked = ##t
songTocColumns = 2
globalSize = 14
lyricSize = 1.6

View File

@ -35,10 +35,7 @@
(string-tokenize (chain-assoc-get 'header:categories props "")))) (string-tokenize (chain-assoc-get 'header:categories props ""))))
(make-null-markup)))) (make-null-markup))))
#(define pdf-encode #(define pdf-encode (@@ (lily framework-ps) pdf-encode))
(if (< (list-ref (ly:version) 1) 24)
ly:encode-string-for-pdf
(@@ (lily framework-ps) pdf-encode)))
% PDF tags % PDF tags
#(define-markup-command (title-to-pdf-toc layout props title) (string?) #(define-markup-command (title-to-pdf-toc layout props title) (string?)
(ly:make-stencil (ly:make-stencil

View File

@ -171,21 +171,6 @@
(cdr revlist))))))))) (cdr revlist)))))))))
\paper { \paper {
indexTitleMarkup = \markup \column {
\fontsize #5 \sans \bold \fill-line { \null \fromproperty #'index:text \null }
\vspace #.5
\justify {
Da die allermeisten Lieder unter verschiedenen Namen bekannt sind,
wollen wir euch ein Inhaltsverzeichnis an die Hand geben, mit dem ihr hoffentlich auf verschiedene Arten fündig werdet.
Die Liedtitel, die auch die Überschriften sind, findet ihr normal gedruckt.
Alle weiteren Alternativtitel oder Liedanfänge sind zur Unterscheidung kursiv gedruckt.
}
\vspace #1
}
categoryTitleMarkup = \markup \column {
\fontsize #5 \sans \bold \fill-line { \null \fromproperty #'index:text \null }
\vspace #1
}
indexItemMarkup = \markup \with-link-symbol-ref #'index:label { indexItemMarkup = \markup \with-link-symbol-ref #'index:label {
\index-item-with-pattern \index-item-with-pattern
} }
@ -199,29 +184,7 @@
} }
} }
%{
#(define-markup-list-command (index layout props) ()
( _i "Outputs an alphabetical sorted index, using the paper
variable @code{indexTitleMarkup} for its title, then the list of
lines built using the @code{indexItem} music function
Usage: @code{\\markuplines \\index}" )
(cons (interpret-markup layout (cons (list (cons 'index:text "Inhaltsverzeichnis")) props)
(ly:output-def-lookup layout 'indexTitleMarkup))
(space-lines (chain-assoc-get 'baseline-skip props)
(map (lambda (index-item)
(let ((label (car index-item))
(index-markup (cadr index-item))
(text (caddr index-item)))
(interpret-markup
layout
(cons (list (cons 'index:page
(markup #:page-ref label "XXX" "?"))
(cons 'index:text text)
(cons 'index:label label))
props)
(ly:output-def-lookup layout index-markup))))
(index-items)))))
%}
#(define (prepare-item-markup items layout) #(define (prepare-item-markup items layout)
(map (lambda (index-item) (map (lambda (index-item)
(let ((label (car index-item)) (let ((label (car index-item))
@ -233,33 +196,18 @@
(ly:output-def-lookup layout index-markup)))) (ly:output-def-lookup layout index-markup))))
(items))) (items)))
#(define-markup-list-command (index-in-columns-with-title layout props index-type title-markup) (symbol? markup?)
#(define-markup-list-command (colindex layout props) () ( _i "Outputs index alphabetical sorted or in categories" )
( _i "Outputs an alphabetical sorted index, using the paper (let ((items (case index-type
variable @code{indexTitleMarkup} for its title, then the list of ((alphabetical) index-items)
lines built using the @code{indexItem} music function ((categories) category-index-items)))
Usage: @code{\\markuplines \\index}" ) (title (interpret-markup layout props title-markup)))
(let ((title (interpret-markup layout (cons (list (cons 'index:text "Inhaltsverzeichnis")) props)
(ly:output-def-lookup layout 'indexTitleMarkup))))
(cons title (cons title
(interpret-markup-list layout props (interpret-markup-list layout props
(make-columnlayout-markup-list songTocColumns 2 (make-columnlayout-markup-list songTocColumns 2
(let ((h (- (ly:output-def-lookup layout 'paper-height) 12))) (let ((h (- (ly:output-def-lookup layout 'paper-height) 12)))
(cons (- h (interval-length (ly:stencil-extent title Y))) h)) (cons (- h (interval-length (ly:stencil-extent title Y))) h))
(prepare-item-markup index-items layout)))))) (prepare-item-markup items layout))))))
#(define-markup-list-command (categoryindex layout props) ()
( _i "Outputs categorized song titles" )
(if (null-list? (category-index-items))
(list)
(let ((title (interpret-markup layout (cons (list (cons 'index:text "Inhaltsverzeichnis nach Kategorien")) props)
(ly:output-def-lookup layout 'categoryTitleMarkup))))
(cons title
(interpret-markup-list layout props
(make-columnlayout-markup-list songTocColumns 2
(let ((h (- (ly:output-def-lookup layout 'paper-height) 12)))
(cons (- h (interval-length (ly:stencil-extent title Y))) h))
(prepare-item-markup category-index-items layout)))))))
indexItem = indexItem =
#(define-music-function (parser location sorttext text) (string? markup?) #(define-music-function (parser location sorttext text) (string? markup?)
@ -271,18 +219,6 @@ indexSection =
"Add a section line to the alphabetical index, using @code{indexSectionMarkup} paper variable markup. This can be used to divide the alphabetical index into different sections, for example one section for each first letter." "Add a section line to the alphabetical index, using @code{indexSectionMarkup} paper variable markup. This can be used to divide the alphabetical index into different sections, for example one section for each first letter."
(add-index-item! 'indexSectionMarkup text sorttext)) (add-index-item! 'indexSectionMarkup text sorttext))
%{
addTitleToTOC = #(define-music-function (parser location title) (string?)
#{
\indexItem #title \markup { #title }
#})
addAltTitleToTOC = #(define-music-function (parser location title) (string?)
#{
\indexItem #title \markup { \italic #title }
#})
%}
#(define (extract-var-from-module module sym) #(define (extract-var-from-module module sym)
(let ((variableref (assoc-ref module sym))) (let ((variableref (assoc-ref module sym)))
(if variableref (variable-ref variableref) #f)) (if variableref (variable-ref variableref) #f))

View File

@ -5,7 +5,7 @@
#{ \markup { \column { #{ \markup { \column {
$(let ((verse-markup-string ( $(let ((verse-markup-string (
string-append "\\line { " string-append "\\line { "
(ly:regex-replace (ly:make-regex "\n") text " } \\line { ") (ly:regex-replace (ly:make-regex "\r?\n") text " } \\line { ")
" \\size-box-to-box ##f ##t \"\" \"Agj\" }" ))) " \\size-box-to-box ##f ##t \"\" \"Agj\" }" )))
(ly:parser-include-string verse-markup-string)) (ly:parser-include-string verse-markup-string))
}}#} }}#}
@ -66,17 +66,18 @@
% Text über Text mittig darstellen % Text über Text mittig darstellen
#(define-markup-command (textup layout props text uptext) (markup? markup?) #(define-markup-command (textup layout props text uptext) (markup? markup?)
"Markup über Text mittig darstellen." "Markup über Text mittig darstellen."
(let ((verselayout (chain-assoc-get 'verselayout props generalLayout)))
(interpret-markup layout props (interpret-markup layout props
#{\markup { #{\markup {
\size-box-to-box-style-dependent ##t ##f \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 { \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 } \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 #text
} }
#} #}
)) )))
#(define-markup-command (anchor-x-between layout props arga argb) #(define-markup-command (anchor-x-between layout props arga argb)
(markup? markup?) (markup? markup?)
@ -87,44 +88,70 @@
)) ))
#(define-markup-command (stanza-raw layout props arg) #(define-markup-command (stanza-raw layout props arg)
(markup?) (string-or-music?)
(let ((verselayout (chain-assoc-get 'verselayout props generalLayout)))
(interpret-markup layout props (interpret-markup layout props
(if (and (string? arg) (string-null? arg)) (if (and (string? arg) (string-null? arg))
" " " "
#{\markup #{\markup
\score { \new Lyrics { \lyricmode { \set stanza = #arg "" } } \layout { \generalLayout } } \score { \new Lyrics { \lyricmode { #(if (ly:music? arg) arg #{ \set stanza = #arg #}) "" } } \layout { \verselayout } }
#} #}
))) ))))
#(define-markup-command (stanza layout props arg) #(define-markup-command (stanza layout props arg)
(markup?) (string-or-music?)
(interpret-markup layout props (interpret-markup layout props
(make-size-box-to-box-markup #f #t (make-stanza-raw-markup arg) (make-stanza-raw-markup "x")))) (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 "\r?\n") text " ")))
(if (null? break-words)
newtext
(make-custom-linebreaks
(cdr break-words)
(ly:regex-replace
(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
1 "\n" 2))))))
% Kompletten Vers mit Akkorden % Kompletten Vers mit Akkorden
#(define-markup-command (chordverse layout props stanza verse) (markup? string?) #(define-markup-command (chordverse layout props stanza verse) (string-or-music? string?)
#:properties ((intraverse-vspace 0)) #:properties ((intraverse-vspace 0)(custom-verse-breaks '()))
"Vers mit Akkorden" "Vers mit Akkorden"
(let* ((fromto (chain-assoc-get 'transposition props #f)) (let* ((fromto (chain-assoc-get 'transposition props #f))
(transp (if fromto (transp (if fromto
(string-append "\\transpose " (car fromto) " " (cdr fromto)) (string-append "\\transpose " (car fromto) " " (cdr fromto))
""))) ""))
(verselayout (chain-assoc-get 'verselayout props generalLayout)))
(interpret-markup layout props (interpret-markup layout props
(markup #:override `(baseline-skip . ,(+ intraverse-vspace songTextLineHeigth)) #:anchor-x-between #:stanza stanza (markup #:override `(baseline-skip . ,(+ intraverse-vspace songTextLineHeigth)) #:anchor-x-between #:stanza stanza
(make-wrap-newline-markup (make-wrap-newline-markup
(ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)") (ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)")
(ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") verse " \\concat { " 1 " } ") (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 { \\verseChordLayout } }") "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verselayout } }")
) )
)))) ))))
% Kompletter Vers aus dem Akkorde entfernt werden % Kompletter Vers aus dem Akkorde entfernt werden
#(define-markup-command (nochordverse layout props stanza verse) (markup? string?) #(define-markup-command (nochordverse layout props stanza verse) (string-or-music? string?)
#:properties ((intraverse-vspace 0)) #:properties ((intraverse-vspace 0)(custom-verse-breaks '()))
"Vers ohne Akkorde" "Vers ohne Akkorde"
(interpret-markup layout props (interpret-markup layout props
(markup #:override `(baseline-skip . ,(+ intraverse-vspace 3.0)) #:anchor-x-between #:stanza stanza (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)
) )
) )
) )
@ -142,26 +169,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)))
(column-data (make-list verse-cols)))
(let columnize-list ((index 0) (items versegroup))
(if (not (null? items))
(let* ((column-index (if verse-ordering-horizontal
(modulo index verse-cols) (modulo index verse-cols)
(floor (/ index column-item-count))))) (floor (/ index column-item-count))))
(hashv-set! h i (cons el (hashv-ref h i (list)))) (set! index (+ index 1)))) (column-markups (list-ref column-data column-index)))
versegroup) (list-set! column-data column-index (cons (car items) column-markups))
(columnize-list (+ index 1) (cdr items)))))
(interpret-markup layout props (interpret-markup layout props
(make-fill-line-markup (cons (make-verseformat-markup (make-line-markup (make-fill-line-markup (list (make-verseformat-markup (make-line-markup
(reverse (hash-fold (lambda (key value l) (add-markup-between-elements #f
(cons (make-column-markup (make-hspace-markup verse-hspace)
(fold (lambda (v verses) (map (lambda (column-markups)
(cons v (if (null? verses) (make-column-markup
verses (add-markup-between-elements #t (make-vspace-markup verse-vspace) column-markups)))
(cons (make-vspace-markup verse-vspace) verses)))) column-data)))))))))
(list) value))
(if (null-list? l)
l
(cons (make-hspace-markup verse-hspace) l))))
(list) h))))
(list))))))