1 Commits

Author SHA1 Message Date
db57e6d5c4 Variable eingefügt 2023-09-16 22:50:44 +02:00
21 changed files with 297 additions and 246 deletions

View File

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

View File

@ -1,3 +1,5 @@
\version "2.18"
#(define song-list '()) #(define song-list '())
#(define (files-in-directory dirname) #(define (files-in-directory dirname)
@ -118,7 +120,7 @@ includeSong =
#{ #{
\bookOutputName #filename \bookOutputName #filename
#} #}
(ly:parser-parse-string (ly:parser-clone) (ly:parser-parse-string (if (< (list-ref (ly:version) 1) 19) (ly:parser-clone parser) (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
@ -153,7 +155,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! (ly:parser-lookup '$current-book) (ly:book-add-bookpart! (if (< (list-ref (ly:version) 1) 19) (ly:parser-lookup parser '$current-book) (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,16 +8,6 @@ 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?)
#{ #{
@ -81,7 +71,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 = #'serif \override ChordName.font-family = #'sans
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)
@ -94,16 +84,26 @@ 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 { \score { \new ChordNames { #(if (< (list-ref (ly:version) 1) 19)
#(ly:parser-include-string (string-append "\\chordmode { s4 " chord " }")) (ly:parser-include-string parser (string-append "\\chordmode { s4 " chord " }"))
} \layout { \generalLayout } } (ly:parser-include-string (string-append "\\chordmode { s4 " chord " }"))
\override #'(fret-diagram-details . ((barre-type . straight))) { ) } \layout { \generalLayout } }
\fret-diagram-terse #fret \override #'(fret-diagram-details . (
(barre-type . straight))) {
\fret-diagram-terse #fret
} }
} }
} }

View File

@ -3,26 +3,20 @@
#(make-on-the-fly-markup #(make-on-the-fly-markup
(lambda (layout props m) (lambda (layout props m)
(let ((name (chain-assoc-get 'author:name props #f)) (let ((name (chain-assoc-get 'author:name props #f))
(trail_name (chain-assoc-get 'author:trail_name props #f)) (trail_name (chain-assoc-get 'author:trail_name props #f))
(birth_year (chain-assoc-get 'author:birth_year props #f)) (birth_year (chain-assoc-get 'author:birth_year props #f))
(death_year (chain-assoc-get 'author:death_year props #f)) (death_year (chain-assoc-get 'author:death_year props #f))
(organization (chain-assoc-get 'author:organization 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 (interpret-markup layout props
(if (or (string-present trail_name) (string-present name)) (string-append
(render_informations (filter string-present (list name
trail_name (if trail_name (ly:format " (~a)" trail_name) "")
name (if (and birth_year death_year)
(if (and (string-present birth_year) (string-present death_year)) (ly:format ", (~a~a)" birth_year death_year)
(ly:format "~a~a" birth_year death_year) (if birth_year
(if (string-present birth_year) (ly:format ", (*~a)" birth_year)
(ly:format "*~a" birth_year) (if death_year (ly:format ", (†~a)" death_year) "")))
(if (string-present death_year) (ly:format "~a" death_year) ""))) (if organization (ly:format ", ~a" organization) "")
organization
)))
""
)))) ))))
(make-null-markup) (make-null-markup)
) )

View File

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

View File

@ -1,28 +0,0 @@
\paper {
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)))
(stack-lines DOWN 0.0 (chain-assoc-get 'baseline-skip props)
(interpret-markup-list layout props
(append
(make-wordwrap-internal-markup-list #t (list
(if poet-maybe-with-composer (markup
(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
(if copyright (string-append "© " 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)
)
}

View File

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

View File

@ -32,36 +32,33 @@
(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 (
(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))) (blockwidth (* (chain-assoc-get 'header:songinfo-size-factor props 0.9) (ly:output-def-lookup layout 'line-width)))
(infotext (chain-assoc-get 'header:songinfo props #f))
(poet (chain-assoc-get 'header:poet props (if poetId (if poet-and-composer-same (format-poet-and-composer poetId) (format-poet poetId)) #f)))
(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) #f)))
(copyright (chain-assoc-get 'header:copyright props #f)) (poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked))
(translation (chain-assoc-get 'header:translation props #f)) (between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
(pronunciation (chain-assoc-get 'header:pronunciation props #f)) (copyright (chain-assoc-get 'header:copyright props #f)))
(year_text (chain-assoc-get 'header:year_text props #f)) (markup #:override '(baseline-skip . 3.0) (
(year_melody (chain-assoc-get 'header:year_melody props #f))) make-fontsize-markup songInfoFontSize
(markup (make-sans-markup
#:override (cons 'songinfo:poet-maybe-with-composer ;%\override #'(line-width . 92) \wordwrap-field #symbol
(if (and poet-maybe-with-composer (not (and (string? poet-maybe-with-composer) (string-null? poet-maybe-with-composer)))) poet-maybe-with-composer #f)) (make-column-markup (list
#:override (cons 'songinfo:composer (make-line-markup
(if (and composer (not (and (string? composer) (string-null? composer)))) composer #f)) (list
#:override (cons 'songinfo:copyright (if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "")
(if (and copyright (not (and (string? copyright) (string-null? copyright)))) copyright #f)) (if (and composer (not poet-and-composer-stacked)) composer ""))
#:override (cons 'songinfo:infotext )
(if (and infotext (not (and (string? infotext) (string-null? infotext)))) infotext #f)) (if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "")
#:override (cons 'songinfo:translation (make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append
(if (and translation (not (and (string? translation) (string-null? translation)))) translation #f)) (if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "")
#:override (cons 'songinfo:pronunciation (if infotext infotext "")
(if (and pronunciation (not (and (string? pronunciation) (string-null? pronunciation)))) pronunciation #f)) )))
#: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)))
) )
@ -75,12 +72,6 @@
) )
)))) ))))
#(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
@ -88,14 +79,14 @@
oddFooterMarkup = \markup { oddFooterMarkup = \markup {
\fill-line { \fill-line {
\line { \null } \line { \null }
\line { \general-align #Y #DOWN \fractional-line-width \print-songinfo } \line { \general-align #Y #DOWN \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 \fractional-line-width \print-songinfo } \line { \general-align #Y #DOWN \print-songinfo }
\line { \null } \line { \null }
} }
} }

View File

@ -1,6 +1,28 @@
\version "2.25.8" \version "2.18"
#(ly:set-option 'relative-includes #t) #(ly:set-option 'relative-includes #t)
#(define noDefaultOutput #t) \include #(if (< (list-ref (ly:version) 1) 24) "legacy-lilypond-compatibility.ly" "void.ly")
\include "all_base_includes.ly" #(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 #(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

@ -0,0 +1,22 @@
% 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

@ -0,0 +1,27 @@
% 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)))))

View File

@ -1,8 +0,0 @@
#(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,15 +3,6 @@
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)) 'default defaultSongStyle) (if (not (defined? 'defaultSongStyle)) 'börnel defaultSongStyle)
songStyle)) songStyle))
#(if (not (boolean? bookStyle)) #(if (not (boolean? bookStyle))

15
styles/bock.ly Normal file
View File

@ -0,0 +1,15 @@
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

15
styles/börnel.ly Normal file
View File

@ -0,0 +1,15 @@
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

15
styles/büdel.ly Normal file
View File

@ -0,0 +1,15 @@
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,7 +35,10 @@
(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 (@@ (lily framework-ps) pdf-encode)) #(define 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

@ -1,3 +1,5 @@
\include "../lilypond-custom-includes/toc_config.ly"
% embed all category images in postscript once % embed all category images in postscript once
#(define-markup-list-command (embed-category-images layout props)() #(define-markup-list-command (embed-category-images layout props)()
(map (lambda (category) (map (lambda (category)
@ -171,6 +173,11 @@
(cdr revlist))))))))) (cdr revlist)))))))))
\paper { \paper {
indexTitleMarkup = \tocSubtitleText
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
} }
@ -184,7 +191,29 @@
} }
} }
%{
#(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))
@ -196,18 +225,33 @@
(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?)
( _i "Outputs index alphabetical sorted or in categories" ) #(define-markup-list-command (colindex layout props) ()
(let ((items (case index-type ( _i "Outputs an alphabetical sorted index, using the paper
((alphabetical) index-items) variable @code{indexTitleMarkup} for its title, then the list of
((categories) category-index-items))) lines built using the @code{indexItem} music function
(title (interpret-markup layout props title-markup))) Usage: @code{\\markuplines \\index}" )
(cons title (let ((title (interpret-markup layout (cons (list (cons 'index:text "Inhaltsverzeichnis")) props)
(interpret-markup-list layout props (ly:output-def-lookup layout 'indexTitleMarkup))))
(make-columnlayout-markup-list songTocColumns 2 (cons title
(let ((h (- (ly:output-def-lookup layout 'paper-height) 12))) (interpret-markup-list layout props
(cons (- h (interval-length (ly:stencil-extent title Y))) h)) (make-columnlayout-markup-list songTocColumns 2
(prepare-item-markup items layout)))))) (let ((h (- (ly:output-def-lookup layout 'paper-height) 12)))
(cons (- h (interval-length (ly:stencil-extent title Y))) h))
(prepare-item-markup index-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?)
@ -219,6 +263,18 @@ 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 "\r?\n") text " } \\line { ") (ly:regex-replace (ly:make-regex "\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,18 +66,17 @@
% 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 { \verselayout } } \size-box-to-box ##f ##t #uptext \score { \chords { g4:m a } \layout { \generalLayout } }
} }
#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?)
@ -88,61 +87,44 @@
)) ))
#(define-markup-command (stanza-raw layout props arg) #(define-markup-command (stanza-raw layout props arg)
(string-or-music?) (markup?)
(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 { #(if (ly:music? arg) arg #{ \set stanza = #arg #}) "" } } \layout { \verselayout } } \score { \new Lyrics { \lyricmode { \set stanza = #arg "" } } \layout { \generalLayout } }
#} #}
)))) )))
#(define-markup-command (stanza layout props arg) #(define-markup-command (stanza layout props arg)
(string-or-music?) (markup?)
(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 "(" (ly:regex-replace (ly:make-regex "(.)") (car break-words) "(?:\\(?" 1 "| *,[^,)]+\\)" 1 ")") "(?: *,[^,)]+\\))?)(.*)$"))
newtext
1 "\n" 2))))))
% Kompletten Vers mit Akkorden % Kompletten Vers mit Akkorden
#(define-markup-command (chordverse layout props stanza verse) (string-or-music? string?) #(define-markup-command (chordverse layout props stanza verse) (markup? string?)
#:properties ((intraverse-vspace 0)(custom-verse-breaks '())) #:properties ((intraverse-vspace 0))
"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(]*)+)") (handle-custom-newlines custom-verse-breaks verse) " \\concat { " 1 " } ") (ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") verse " \\concat { " 1 " } ")
"\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verselayout } }") "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }")
) )
)))) ))))
% Kompletter Vers aus dem Akkorde entfernt werden % Kompletter Vers aus dem Akkorde entfernt werden
#(define-markup-command (nochordverse layout props stanza verse) (string-or-music? string?) #(define-markup-command (nochordverse layout props stanza verse) (markup? string?)
#:properties ((intraverse-vspace 0)(custom-verse-breaks '())) #:properties ((intraverse-vspace 0))
"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 "\\(([^,]*),([^)]*)\\)") (handle-custom-newlines custom-verse-breaks verse) 1) #:wrap-newline (ly:regex-replace (ly:make-regex "\\(([^,]*),([^)]*)\\)") verse 1)
) )
) )
) )
@ -160,25 +142,26 @@
(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"
(define (add-markup-between-elements reverses markup-between elements) (let ((h (make-hash-table verse-cols))
((if reverses fold fold-right) (lambda (element filled-list) (index 0)
(cons element (if (null? filled-list) '() (cons markup-between filled-list)))) (column-item-count (ceiling (/ (length versegroup) verse-cols))))
'() elements)) (for-each (lambda (el)
(let* ((column-item-count (ceiling (/ (length versegroup) verse-cols))) (let ((i (if verse-ordering-horizontal
(column-data (make-list verse-cols))) (modulo index verse-cols)
(let columnize-list ((index 0) (items versegroup)) (floor (/ index column-item-count)))))
(if (not (null? items)) (hashv-set! h i (cons el (hashv-ref h i (list)))) (set! index (+ index 1))))
(let* ((column-index (if verse-ordering-horizontal versegroup)
(modulo index verse-cols) (interpret-markup layout props
(floor (/ index column-item-count)))) (make-fill-line-markup (cons (make-verseformat-markup (make-line-markup
(column-markups (list-ref column-data column-index))) (reverse (hash-fold (lambda (key value l)
(list-set! column-data column-index (cons (car items) column-markups)) (cons (make-column-markup
(columnize-list (+ index 1) (cdr items))))) (fold (lambda (v verses)
(interpret-markup layout props (cons v (if (null? verses)
(make-fill-line-markup (list (make-verseformat-markup (make-line-markup verses
(add-markup-between-elements #f (cons (make-vspace-markup verse-vspace) verses))))
(make-hspace-markup verse-hspace) (list) value))
(map (lambda (column-markups) (if (null-list? l)
(make-column-markup l
(add-markup-between-elements #t (make-vspace-markup verse-vspace) column-markups))) (cons (make-hspace-markup verse-hspace) l))))
column-data))))))))) (list) h))))
(list))))))