Compare commits
12 Commits
set-spacin
...
487bf457fb
Author | SHA1 | Date | |
---|---|---|---|
487bf457fb | |||
47bb7991b8 | |||
d94703547c | |||
f0ffd3f630 | |||
8dfbc5ef25 | |||
8800341e18 | |||
d56c11c5ff | |||
754682afcf | |||
88f0dc9f8f | |||
e9b904c32c | |||
fd14138d0b | |||
a1bc48b824 |
@ -1,7 +1,13 @@
|
||||
#(define noStandaloneOutput (if (defined? 'noStandaloneOutput) noStandaloneOutput #f))
|
||||
|
||||
#(if (defined? 'LAYOUT) #f (load "json_parser.scm"))
|
||||
#(use-modules (json parser))
|
||||
#(if (defined? 'LAYOUT) #f
|
||||
(let ((scmdir (string-append (dirname (current-filename)) file-name-separator-string "scm" file-name-separator-string)))
|
||||
(load (string-append scmdir "json_parser.scm"))
|
||||
(load (string-append scmdir "resolve_inherits.scm"))
|
||||
(load (string-append scmdir "yaml_parser.scm"))))
|
||||
#(define AUTHOR_DATA (if (defined? 'AUTHOR_DATA) AUTHOR_DATA (parse-yml-file "../../lilypond-song-includes/data/authors.yml")))
|
||||
#(define SONG_DATA (if (defined? 'SONG_DATA) SONG_DATA (parse-yml-file "../../lilypond-song-includes/data/songs.yml")))
|
||||
|
||||
\include "basic_format_and_style_settings.ly"
|
||||
\include "eps_file_from_song_dir.ly"
|
||||
\include "title_with_category_images.ly"
|
||||
|
44
appendix.ly
Normal file
44
appendix.ly
Normal file
@ -0,0 +1,44 @@
|
||||
appendix =
|
||||
#(define-void-function (parser location title) (markup?)
|
||||
(define (appendix-item->markup layout props appendix-item)
|
||||
(interpret-markup layout props
|
||||
(markup
|
||||
#:override (cons 'appendixItem:heading (assoc-ref appendix-item "heading"))
|
||||
#:override (cons 'appendixItem:text (assoc-ref appendix-item "text"))
|
||||
(ly:output-def-lookup layout 'appendixItemMarkup))))
|
||||
(ly:book-add-bookpart! (ly:parser-lookup '$current-book)
|
||||
#{
|
||||
\bookpart {
|
||||
\markup { #title }
|
||||
#(for-each
|
||||
(lambda (item)
|
||||
(add-score (ly:make-page-label-marker (string->symbol (car item))))
|
||||
(add-text
|
||||
(make-on-the-fly-markup
|
||||
(lambda (layout props arg) (appendix-item->markup layout props (cdr item)))
|
||||
(make-null-markup)))
|
||||
)
|
||||
(reverse APPENDIX_DATA))
|
||||
}
|
||||
#}))
|
||||
|
||||
#(define-markup-command (appendix-ref layout props label) (symbol?)
|
||||
"call page-ref to appendix-item"
|
||||
(interpret-markup layout props
|
||||
(markup #:with-link label
|
||||
#:override (cons 'appendixPage (make-page-ref-markup label "XXX" "?"))
|
||||
(ly:output-def-lookup layout 'appendixReferenceMarkup))))
|
||||
|
||||
\paper {
|
||||
appendixItemMarkup = \markup {
|
||||
\left-column {
|
||||
\line { \large \bold \fromproperty #'appendixItem:heading }
|
||||
\vspace #0.2
|
||||
\sans \wordwrap-field #'appendixItem:text
|
||||
\vspace #0.7
|
||||
}
|
||||
}
|
||||
appendixReferenceMarkup = \markup {
|
||||
\fromproperty #'appendixPage
|
||||
}
|
||||
}
|
@ -105,13 +105,21 @@ romanStanza =
|
||||
#(define-music-function (parser location) ()
|
||||
#{ \override StanzaNumber.style = #'roman #})
|
||||
|
||||
override-stanza =
|
||||
#(define-music-function (parser location stanzanumber) (number?)
|
||||
#{
|
||||
\once \override StanzaNumber.forced-spacing = #stanzanumber % misuse property "forced-spacing" to override the stanzanumber
|
||||
#}
|
||||
)
|
||||
|
||||
stanza =
|
||||
#(define-music-function (parser location stanzanumber) (number?)
|
||||
#{
|
||||
\once \override StanzaNumber.layer = 23 % set this to signal that there is a real stanza and no repeat signs
|
||||
\applyContext
|
||||
#(lambda (context)
|
||||
(let* ((stanzastyle (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
|
||||
(let* ((stanzanumber (ly:assoc-get 'forced-spacing (ly:context-grob-definition context 'StanzaNumber) stanzanumber))
|
||||
(stanzastyle (ly:assoc-get 'style (ly:context-grob-definition context 'StanzaNumber)))
|
||||
(formattedStanzaNumber (format #f (if (eq? stanzastyle 'roman) romanStanzaFormat stanzaFormat) stanzanumber)))
|
||||
(ly:context-set-property! context 'stanza formattedStanzaNumber)))
|
||||
#}
|
||||
@ -148,3 +156,22 @@ repStopWithTag = \lyricmode {
|
||||
\set stanza = \markup { \repStop }
|
||||
}
|
||||
}
|
||||
|
||||
rightHyphen = \lyricmode {
|
||||
\once \override StanzaNumber.font-series = #'normal
|
||||
\once \override StanzaNumber.direction = 1
|
||||
\set stanza = "-"
|
||||
}
|
||||
|
||||
leftHyphen = \lyricmode {
|
||||
\once \override StanzaNumber.font-series = #'normal
|
||||
\set stanza = "-"
|
||||
}
|
||||
|
||||
multiVerseSkips =
|
||||
#(define-music-function (parser location skips) (number?)
|
||||
#{ \tag #'multiVerse { \repeat unfold #skips { \skip4 } } #})
|
||||
|
||||
alt =
|
||||
#(define-music-function (parser location a b) (ly:music? ly:music?)
|
||||
#{ \tag #'firstVerse { #a } \tag #'multiVerse { #b } #})
|
2
break_paged_output.ily
Normal file
2
break_paged_output.ily
Normal file
@ -0,0 +1,2 @@
|
||||
\include "lilypond-book-preamble.ly"
|
||||
#(ly:set-option 'separate-page-formats "pdf")
|
@ -138,3 +138,33 @@ generalLayout = \layout {
|
||||
}
|
||||
}
|
||||
#}))
|
||||
|
||||
% If you add this engraver to ChordNames Context chords get only printed on chordchanges and if its the first chord after line break.
|
||||
Ensure_first_chord_after_line_break_printed_engraver =
|
||||
#(lambda (ctx)
|
||||
(define last-system-column-rank 0)
|
||||
(make-engraver
|
||||
(acknowledgers
|
||||
((chord-name-interface this-engraver grob source-engraver)
|
||||
(ly:grob-set-property! grob 'after-line-breaking
|
||||
(lambda (grob)
|
||||
(let ((current-system-column-rank (car (ly:grob-spanned-column-rank-interval (ly:grob-system grob)))))
|
||||
(if (and
|
||||
(ly:context-property ctx 'chordChanges #f)
|
||||
(ly:grob-property grob 'begin-of-line-visible #f)
|
||||
(not (= last-system-column-rank current-system-column-rank)))
|
||||
; the current chord handling implementation in lilypond uses 'begin-of-line-visible to mark repeated chords
|
||||
(ly:grob-set-property! grob 'begin-of-line-visible #f))
|
||||
(set! last-system-column-rank current-system-column-rank)
|
||||
(ly:chord-name::after-line-breaking grob)
|
||||
)))))))
|
||||
|
||||
% If you add this engraver to ChordNames Context chords get only printed on chordchanges and not at newline.
|
||||
Ignoring_newline_chord_changes_engraver =
|
||||
#(lambda (ctx)
|
||||
(make-engraver
|
||||
(acknowledgers
|
||||
((chord-name-interface this-engraver grob source-engraver)
|
||||
(when (and (ly:context-property ctx 'chordChanges #f) (ly:grob-property grob 'begin-of-line-visible #f))
|
||||
(ly:grob-suicide! grob)
|
||||
)))))
|
22
scm/resolve_inherits.scm
Normal file
22
scm/resolve_inherits.scm
Normal file
@ -0,0 +1,22 @@
|
||||
(define (resolve-inherit-entry-in-list alist entry)
|
||||
(let* ((key (car entry))
|
||||
(attributes (cdr entry))
|
||||
(inherits (assoc-ref attributes "inherits")))
|
||||
(if inherits
|
||||
(let* ((alist-without-entry (alist-delete key alist))
|
||||
(inherit-entry (assoc inherits alist-without-entry))
|
||||
(inherits-attributes (if inherit-entry (alist-copy (cdr (resolve-inherit-entry-in-list alist-without-entry inherit-entry)))))
|
||||
(override-attributes (alist-delete "inherits" attributes)))
|
||||
(if inherit-entry
|
||||
(begin
|
||||
(for-each (lambda (attribute) (assoc-set! inherits-attributes (car attribute) (cdr attribute))) override-attributes)
|
||||
(cons key inherits-attributes)
|
||||
)
|
||||
(ly:error "~a can not inherit from ~a" key inherits))
|
||||
)
|
||||
entry
|
||||
)))
|
||||
|
||||
(define (resolve-inherits alist)
|
||||
(map (lambda (entry) (resolve-inherit-entry-in-list alist entry)) alist)
|
||||
)
|
10
scm/yaml_parser.scm
Normal file
10
scm/yaml_parser.scm
Normal file
@ -0,0 +1,10 @@
|
||||
(use-modules (ice-9 popen) (ice-9 textual-ports) (json parser))
|
||||
|
||||
(define (yml-file->scm filename)
|
||||
(let* ((python_cmd (string-append "import sys, yaml, json; print(json.dumps(yaml.safe_load(open('" filename "'))))"))
|
||||
(pipe (open-pipe* OPEN_READ "python" "-c" python_cmd))
|
||||
(json (get-string-all pipe)))
|
||||
(close-pipe pipe)
|
||||
(json-string->scm json)))
|
||||
|
||||
(define (parse-yml-file filename) (resolve-inherits (yml-file->scm filename)))
|
@ -3,6 +3,3 @@
|
||||
#(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)))
|
@ -18,19 +18,19 @@ TEXT = \markuplist {
|
||||
\TEXT
|
||||
}
|
||||
|
||||
% nur Output wenn noStandaloneOutput auf false steht
|
||||
output = #(if (not noStandaloneOutput)
|
||||
#{
|
||||
\bookpart {
|
||||
\HEADER
|
||||
|
||||
#(if (not noStandaloneOutput)
|
||||
(begin
|
||||
(let ((header (ly:book-header HEADER)) (paper (ly:book-paper HEADER)))
|
||||
(if header (set! $defaultheader header))
|
||||
(if paper (set! $defaultpaper paper))
|
||||
)
|
||||
(add-score #{
|
||||
\score {
|
||||
\MUSIC
|
||||
\layout { \LAYOUT }
|
||||
}
|
||||
|
||||
\TEXT
|
||||
|
||||
}#})
|
||||
(add-score TEXT)
|
||||
(add-score #{
|
||||
\score {
|
||||
\unfoldRepeats { \MUSIC \INLINESCOREMUSIC }
|
||||
\midi {
|
||||
@ -40,15 +40,5 @@ output = #(if (not noStandaloneOutput)
|
||||
tempoWholesPerMinute = #(ly:make-moment midiQuarterNoteSpeed 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#}
|
||||
)
|
||||
|
||||
% if we don't want a standalone output, cause we compile a book, we just have an empty output here,
|
||||
% so lilypond does not generate output for this song
|
||||
\book {
|
||||
\bookpart { \output }
|
||||
}
|
||||
}#})
|
||||
))
|
@ -277,6 +277,7 @@
|
||||
\ChordNames
|
||||
\override VerticalAxisGroup.staff-affinity = ##f
|
||||
\override ChordName.extra-spacing-width = #'(-0.1 . 0.1)
|
||||
\consists \Ensure_first_chord_after_line_break_printed_engraver
|
||||
}
|
||||
\context {
|
||||
\Score
|
||||
|
Reference in New Issue
Block a user