Compare commits
	
		
			12 Commits
		
	
	
		
			19b5fe2d94
			...
			tocSubtitl
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					db57e6d5c4 | ||
| 55db0e0e31 | |||
| 7a0dd88067 | |||
| c20d0327e7 | |||
| 05ea776add | |||
| 7ddd597bed | |||
| 
						 | 
					5c6fde06cc | ||
| 
						 | 
					973d72301c | ||
| fbf273dae9 | |||
| e2dc938c02 | |||
| 301681fffb | |||
| d900a95d79 | 
@@ -1,5 +1,6 @@
 | 
			
		||||
\language "deutsch"
 | 
			
		||||
 | 
			
		||||
\include "default_author_style.ly"
 | 
			
		||||
\include "styles.ly"
 | 
			
		||||
\include #(ly:format "styles/~a.ly" songStyle)
 | 
			
		||||
 | 
			
		||||
@@ -8,15 +9,9 @@
 | 
			
		||||
#(set-default-paper-size songFormatAndSize)
 | 
			
		||||
#(set-global-staff-size globalSize)
 | 
			
		||||
 | 
			
		||||
#(define (default-pango size)
 | 
			
		||||
  (make-pango-font-tree
 | 
			
		||||
    songChordFont
 | 
			
		||||
    songLyricFont
 | 
			
		||||
    "Luxi Mono"
 | 
			
		||||
    (/ size 20)))
 | 
			
		||||
 | 
			
		||||
\paper {
 | 
			
		||||
  #(define fonts (default-pango globalSize))
 | 
			
		||||
  property-defaults.fonts.serif = \songChordFont
 | 
			
		||||
  property-defaults.fonts.sans = \songLyricFont
 | 
			
		||||
  %annotate-spacing = ##t
 | 
			
		||||
  % spacing stuff
 | 
			
		||||
  lyric-size = #lyricSize
 | 
			
		||||
 
 | 
			
		||||
@@ -121,7 +121,7 @@ includeSong =
 | 
			
		||||
     \bookOutputName #filename
 | 
			
		||||
     #}
 | 
			
		||||
    (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")))
 | 
			
		||||
      (set! additional-page-switch-label-list
 | 
			
		||||
        (acons label additional-page-numbers additional-page-switch-label-list))
 | 
			
		||||
@@ -209,7 +209,7 @@ songs =
 | 
			
		||||
     ;(string-join songs "\n")
 | 
			
		||||
     "Nicht inkludiert:"
 | 
			
		||||
     opticalline
 | 
			
		||||
     (string-join (sort-list (lset-difference string=? (files-in-directory (ly:format "../../~a" songPath)) songs) string<?) "\n")
 | 
			
		||||
     (string-join (sort-list (lset-difference string=? (files-in-directory songPath) songs) string<?) "\n")
 | 
			
		||||
     opticalline
 | 
			
		||||
     ) "\n" )
 | 
			
		||||
)))
 | 
			
		||||
@@ -217,16 +217,16 @@ songs =
 | 
			
		||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%
 | 
			
		||||
%% Include Images once and reference them:
 | 
			
		||||
#(define bbox-regexp
 | 
			
		||||
  (make-regexp "%%BoundingBox:[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)"))
 | 
			
		||||
  (ly:make-regex "%%BoundingBox:[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)[ \t]+([0-9-]+)"))
 | 
			
		||||
 | 
			
		||||
#(define (get-postscript-bbox string)
 | 
			
		||||
  "Extract the bbox from STRING, or return #f if not present."
 | 
			
		||||
  (let*
 | 
			
		||||
      ((match (regexp-exec bbox-regexp string)))
 | 
			
		||||
      ((match (ly:regex-exec bbox-regexp string)))
 | 
			
		||||
 | 
			
		||||
    (if match
 | 
			
		||||
        (map (lambda (x)
 | 
			
		||||
               (string->number (match:substring match x)))
 | 
			
		||||
               (string->number (ly:regex-match-substring match x)))
 | 
			
		||||
             (cdr (iota 5)))
 | 
			
		||||
 | 
			
		||||
        #f)))
 | 
			
		||||
 
 | 
			
		||||
@@ -16,6 +16,12 @@ bchord =
 | 
			
		||||
	\revert ChordName.font-series
 | 
			
		||||
#})
 | 
			
		||||
 | 
			
		||||
shiftChord = #(define-music-function (parser location xshift chord) (number? ly:music?)
 | 
			
		||||
#{
 | 
			
		||||
	\once \override ChordName.extra-offset = #`(,xshift . 0)
 | 
			
		||||
	$chord
 | 
			
		||||
#})
 | 
			
		||||
 | 
			
		||||
% kleine Mollakkorde und Alteration ausgeschrieben
 | 
			
		||||
#(define (note-name->german-markup-nosym pitch lowercase?)
 | 
			
		||||
   (define (pitch-alteration-semitones pitch) (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
 | 
			
		||||
@@ -65,7 +71,7 @@ generalLayout = \layout {
 | 
			
		||||
    \semiGermanChords
 | 
			
		||||
    \override ChordName.font-size = \songScoreChordFontSize
 | 
			
		||||
    \override ChordName.font-series = \songChordFontSeries
 | 
			
		||||
    \override ChordName.font-family = #'roman
 | 
			
		||||
    \override ChordName.font-family = #'sans
 | 
			
		||||
    chordNameLowercaseMinor = ##t
 | 
			
		||||
    chordChanges = ##t
 | 
			
		||||
    % eigenen chordRootNamer damit F# = Fis und Gb = Ges (also alteration ausgeschrieben)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								default_author_style.ly
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								default_author_style.ly
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,26 @@
 | 
			
		||||
\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 }
 | 
			
		||||
}
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
   (interpret-markup layout props
 | 
			
		||||
     (let ((filepath (if (string-null? songfilename)
 | 
			
		||||
                          filename
 | 
			
		||||
                          (ly:format "../../~a/~a/~a" songPath songfilename filename))))
 | 
			
		||||
                          (ly:format "~a/~a/~a" songPath songfilename filename))))
 | 
			
		||||
       (if (file-exists? filepath)
 | 
			
		||||
             (make-epsfile-markup Y ysize filepath)
 | 
			
		||||
             (if defaultmarkup
 | 
			
		||||
 
 | 
			
		||||
@@ -1,33 +1,65 @@
 | 
			
		||||
#(define-markup-command (print-songinfo layout props) ()
 | 
			
		||||
 (interpret-markup layout props
 | 
			
		||||
   (let (
 | 
			
		||||
         (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 #f))
 | 
			
		||||
         (composer (chain-assoc-get 'header:composer props #f))
 | 
			
		||||
         (poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked))
 | 
			
		||||
         (between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
 | 
			
		||||
         (copyright (chain-assoc-get 'header:copyright props #f)))
 | 
			
		||||
     (if (chain-assoc-get 'page:is-bookpart-last-page props #f)
 | 
			
		||||
         (markup #:override '(baseline-skip . 3.0) (
 | 
			
		||||
             make-fontsize-markup songInfoFontSize
 | 
			
		||||
             (make-sans-markup
 | 
			
		||||
             ;%\override #'(line-width . 92) \wordwrap-field #symbol
 | 
			
		||||
             (make-column-markup (list
 | 
			
		||||
               (make-line-markup
 | 
			
		||||
                (list
 | 
			
		||||
                 (if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "")
 | 
			
		||||
                 (if (and composer (not poet-and-composer-stacked)) composer ""))
 | 
			
		||||
               )
 | 
			
		||||
               (if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "")
 | 
			
		||||
               (make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append
 | 
			
		||||
                 (if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "")
 | 
			
		||||
                 (if infotext infotext "")
 | 
			
		||||
               )))
 | 
			
		||||
             )))
 | 
			
		||||
           )
 | 
			
		||||
         )
 | 
			
		||||
       (make-null-markup))))
 | 
			
		||||
  (define (songinfo-from songId key)
 | 
			
		||||
    (let ((song (if (defined? 'SONG_DATA) (assoc-ref SONG_DATA songId) #f)))
 | 
			
		||||
      (if song
 | 
			
		||||
        (assoc-ref song key)
 | 
			
		||||
        (ly:warning (ly:format "song with id ~a not found" songId)))))
 | 
			
		||||
 | 
			
		||||
  (define (format-author authorId)
 | 
			
		||||
    (let ((author (if (defined? 'AUTHOR_DATA) (assoc-ref AUTHOR_DATA authorId) #f)))
 | 
			
		||||
      (if author
 | 
			
		||||
        (markup
 | 
			
		||||
          #:override (cons 'author:name (assoc-ref author "name"))
 | 
			
		||||
          #:override (cons 'author:trail_name (assoc-ref author "trail_name"))
 | 
			
		||||
          #:override (cons 'author:birth_year (assoc-ref author "birth_year"))
 | 
			
		||||
          #:override (cons 'author:death_year (assoc-ref author "death_year"))
 | 
			
		||||
          #:override (cons 'author:organization (assoc-ref author "organization"))
 | 
			
		||||
          (ly:output-def-lookup layout 'authorMarkup))
 | 
			
		||||
        (ly:warning (ly:format "author with id ~a not found" authorId)))))
 | 
			
		||||
 | 
			
		||||
  (define (format-poet poetId)
 | 
			
		||||
    (markup #:override (cons 'author (format-author poetId)) (ly:output-def-lookup layout 'poetMarkup)))
 | 
			
		||||
 | 
			
		||||
  (define (format-composer composerId)
 | 
			
		||||
    (markup #:override (cons 'author (format-author composerId)) (ly:output-def-lookup layout 'composerMarkup)))
 | 
			
		||||
 | 
			
		||||
  (define (format-poet-and-composer authorId)
 | 
			
		||||
    (markup #:override (cons 'author (format-author authorId)) (ly:output-def-lookup layout 'poetAndComposerEqualMarkup)))
 | 
			
		||||
 | 
			
		||||
  (interpret-markup layout props
 | 
			
		||||
    (if (chain-assoc-get 'page:is-bookpart-last-page props #f)
 | 
			
		||||
    (let* ((songId (chain-assoc-get 'header:songId props #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)))
 | 
			
		||||
           (poet-and-composer-same (equal? poetId composerId)))
 | 
			
		||||
      (let (
 | 
			
		||||
            (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)))
 | 
			
		||||
            (poet-and-composer-stacked (chain-assoc-get 'header:poet-and-composer-stacked props songInfoPoetAndComposerStacked))
 | 
			
		||||
            (between-poet-and-composer-markup (chain-assoc-get 'header:between-poet-and-composer-markup props (make-hspace-markup 3)))
 | 
			
		||||
            (copyright (chain-assoc-get 'header:copyright props #f)))
 | 
			
		||||
            (markup #:override '(baseline-skip . 3.0) (
 | 
			
		||||
                make-fontsize-markup songInfoFontSize
 | 
			
		||||
                (make-sans-markup
 | 
			
		||||
                ;%\override #'(line-width . 92) \wordwrap-field #symbol
 | 
			
		||||
                (make-column-markup (list
 | 
			
		||||
                  (make-line-markup
 | 
			
		||||
                   (list
 | 
			
		||||
                    (if (and poet (not (and (string? poet) (string-null? poet)))) (markup poet between-poet-and-composer-markup) "")
 | 
			
		||||
                    (if (and composer (not poet-and-composer-stacked)) composer ""))
 | 
			
		||||
                  )
 | 
			
		||||
                  (if (and composer poet-and-composer-stacked) (make-line-markup (list composer)) "")
 | 
			
		||||
                  (make-override-markup `(line-width . ,blockwidth) (make-justify-string-markup (string-append
 | 
			
		||||
                    (if (and copyright (not (and (string? copyright) (string-null? copyright)))) (ly:format "© ~a\n\n" copyright) "")
 | 
			
		||||
                    (if infotext infotext "")
 | 
			
		||||
                  )))
 | 
			
		||||
                )))
 | 
			
		||||
              )
 | 
			
		||||
            )
 | 
			
		||||
          ))
 | 
			
		||||
      (make-null-markup)))
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
#(define-markup-command (print-pagenumber layout props)()
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,10 @@
 | 
			
		||||
 | 
			
		||||
#(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"
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,8 @@
 | 
			
		||||
INLINESCOREMUSIC = {}
 | 
			
		||||
 | 
			
		||||
inline-score =
 | 
			
		||||
#(define-music-function (music) (ly:music?)
 | 
			
		||||
   (set! INLINESCOREMUSIC #{ \INLINESCOREMUSIC #music #})
 | 
			
		||||
    #{
 | 
			
		||||
      \transposable #music
 | 
			
		||||
    #})
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										482
									
								
								json_parser.scm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										482
									
								
								json_parser.scm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,482 @@
 | 
			
		||||
;;; (json parser) --- Guile JSON implementation.
 | 
			
		||||
 | 
			
		||||
;; Copyright (C) 2013-2020 Aleix Conchillo Flaque <aconchillo@gmail.com>
 | 
			
		||||
;;
 | 
			
		||||
;; This file is part of guile-json.
 | 
			
		||||
;;
 | 
			
		||||
;; guile-json is free software: you can redistribute it and/or modify
 | 
			
		||||
;; it under the terms of the GNU General Public License as published by
 | 
			
		||||
;; the Free Software Foundation; either version 3 of the License, or
 | 
			
		||||
;; (at your option) any later version.
 | 
			
		||||
;;
 | 
			
		||||
;; guile-json is distributed in the hope that it will be useful, but
 | 
			
		||||
;; WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 | 
			
		||||
;; General Public License for more details.
 | 
			
		||||
;;
 | 
			
		||||
;; You should have received a copy of the GNU General Public License
 | 
			
		||||
;; along with guile-json. If not, see https://www.gnu.org/licenses/.
 | 
			
		||||
 | 
			
		||||
;;; Commentary:
 | 
			
		||||
 | 
			
		||||
;; JSON module for Guile
 | 
			
		||||
 | 
			
		||||
;;; Code:
 | 
			
		||||
 | 
			
		||||
(define-module (json parser)
 | 
			
		||||
  #:use-module (ice-9 rdelim)
 | 
			
		||||
  #:use-module (ice-9 streams)
 | 
			
		||||
  #:use-module (rnrs io ports)
 | 
			
		||||
  #:export (json->scm
 | 
			
		||||
            json-string->scm
 | 
			
		||||
            json-seq->scm
 | 
			
		||||
            json-seq-string->scm))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Miscellaneuos helpers
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (json-exception port)
 | 
			
		||||
  (throw 'json-invalid port))
 | 
			
		||||
 | 
			
		||||
(define (digit? c)
 | 
			
		||||
  (case c
 | 
			
		||||
    ((#\0 #\1 #\2 #\3 #\4 #\5 #\6 #\7 #\8 #\9) #t)
 | 
			
		||||
    (else #f)))
 | 
			
		||||
 | 
			
		||||
(define (whitespace? c)
 | 
			
		||||
  (case c
 | 
			
		||||
    ((#\sp #\ht #\lf #\cr) #t)
 | 
			
		||||
    (else #f)))
 | 
			
		||||
 | 
			
		||||
(define (control-char? ch)
 | 
			
		||||
  (<= (char->integer ch) #x1F))
 | 
			
		||||
 | 
			
		||||
(define (skip-whitespaces port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((whitespace? ch)
 | 
			
		||||
      (read-char port)
 | 
			
		||||
      (skip-whitespaces port))
 | 
			
		||||
     (else *unspecified*))))
 | 
			
		||||
 | 
			
		||||
(define (expect-string port expected return)
 | 
			
		||||
  (let loop ((n 0))
 | 
			
		||||
    (cond
 | 
			
		||||
     ;; All characters match.
 | 
			
		||||
     ((= n (string-length expected)) return)
 | 
			
		||||
     ;; Go to next characters.
 | 
			
		||||
     ((eqv? (read-char port) (string-ref expected n))
 | 
			
		||||
      (loop (+ n 1)))
 | 
			
		||||
     ;; Anything else is an error.
 | 
			
		||||
     (else (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
(define (expect-delimiter port delimiter)
 | 
			
		||||
  (let ((ch (read-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((not (eqv? ch delimiter)) (json-exception port))
 | 
			
		||||
     ;; Unexpected EOF.
 | 
			
		||||
     ((eof-object? ch) (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
(define (skip-record-separators port)
 | 
			
		||||
  (when (eqv? #\rs (peek-char port))
 | 
			
		||||
    (read-char port)
 | 
			
		||||
    (skip-record-separators port)))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Number parsing helpers
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (expect-digit port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((not (digit? ch)) (json-exception port))
 | 
			
		||||
     ;; Unexpected EOF.
 | 
			
		||||
     ((eof-object? ch) (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
;; Read + or -, and return 1 or -1 respectively. If something different is
 | 
			
		||||
;; found, return 1.
 | 
			
		||||
(define (read-sign port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((eqv? ch #\+)
 | 
			
		||||
      (read-char port)
 | 
			
		||||
      1)
 | 
			
		||||
     ((eqv? ch #\-)
 | 
			
		||||
      (read-char port)
 | 
			
		||||
      -1)
 | 
			
		||||
     (else 1))))
 | 
			
		||||
 | 
			
		||||
(define (read-digit-value port)
 | 
			
		||||
  (let ((ch (read-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((eqv? ch #\0) 0)
 | 
			
		||||
     ((eqv? ch #\1) 1)
 | 
			
		||||
     ((eqv? ch #\2) 2)
 | 
			
		||||
     ((eqv? ch #\3) 3)
 | 
			
		||||
     ((eqv? ch #\4) 4)
 | 
			
		||||
     ((eqv? ch #\5) 5)
 | 
			
		||||
     ((eqv? ch #\6) 6)
 | 
			
		||||
     ((eqv? ch #\7) 7)
 | 
			
		||||
     ((eqv? ch #\8) 8)
 | 
			
		||||
     ((eqv? ch #\9) 9)
 | 
			
		||||
     (else (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
;; Read digits [0..9].
 | 
			
		||||
(define (read-digits port)
 | 
			
		||||
  (expect-digit port)
 | 
			
		||||
  (let loop ((ch (peek-char port)) (number 0))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((digit? ch)
 | 
			
		||||
      (let ((value (read-digit-value port)))
 | 
			
		||||
        (loop (peek-char port) (+ (* number 10) value))))
 | 
			
		||||
     (else number))))
 | 
			
		||||
 | 
			
		||||
(define (read-digits-fraction port)
 | 
			
		||||
  (expect-digit port)
 | 
			
		||||
  (let loop ((ch (peek-char port)) (number 0) (length 0))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((digit? ch)
 | 
			
		||||
      (let ((value (read-digit-value port)))
 | 
			
		||||
        (loop (peek-char port) (+ (* number 10) value) (+ length 1))))
 | 
			
		||||
     (else
 | 
			
		||||
      (/ number (expt 10 length))))))
 | 
			
		||||
 | 
			
		||||
(define (read-exponent port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((or (eqv? ch #\e) (eqv? ch #\E))
 | 
			
		||||
      (read-char port)
 | 
			
		||||
      (let ((sign (read-sign port))
 | 
			
		||||
            (digits (read-digits port)))
 | 
			
		||||
        (if (<= digits 1000) ;; Some maximum exponent.
 | 
			
		||||
            (expt 10 (* sign digits))
 | 
			
		||||
            (json-exception port))))
 | 
			
		||||
     (else 1))))
 | 
			
		||||
 | 
			
		||||
(define (read-fraction port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((eqv? ch #\.)
 | 
			
		||||
      (read-char port)
 | 
			
		||||
      (read-digits-fraction port))
 | 
			
		||||
     (else 0))))
 | 
			
		||||
 | 
			
		||||
(define (read-positive-number port)
 | 
			
		||||
  (let* ((number
 | 
			
		||||
          (let ((ch (peek-char port)))
 | 
			
		||||
            (cond
 | 
			
		||||
             ;; Numbers that start with 0 must be a fraction.
 | 
			
		||||
             ((eqv? ch #\0)
 | 
			
		||||
              (read-char port)
 | 
			
		||||
              0)
 | 
			
		||||
             ;; Otherwise read more digits.
 | 
			
		||||
             (else (read-digits port)))))
 | 
			
		||||
         (fraction (read-fraction port))
 | 
			
		||||
         (exponent (read-exponent port))
 | 
			
		||||
         (result (* (+ number fraction) exponent)))
 | 
			
		||||
    (if (and (zero? fraction) (>= exponent 1))
 | 
			
		||||
        result
 | 
			
		||||
        (exact->inexact result))))
 | 
			
		||||
 | 
			
		||||
(define (json-read-number port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ;; Negative numbers.
 | 
			
		||||
     ((eqv? ch #\-)
 | 
			
		||||
      (read-char port)
 | 
			
		||||
      (expect-digit port)
 | 
			
		||||
      (* -1 (read-positive-number port)))
 | 
			
		||||
     ;; Positive numbers.
 | 
			
		||||
     ((digit? ch)
 | 
			
		||||
      (read-positive-number port))
 | 
			
		||||
     ;; Anything else is an error.
 | 
			
		||||
     (else (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Object parsing helpers
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (read-pair port null ordered)
 | 
			
		||||
  ;; Read key.
 | 
			
		||||
  (let ((key (json-read-string port)))
 | 
			
		||||
    (skip-whitespaces port)
 | 
			
		||||
    (let ((ch (peek-char port)))
 | 
			
		||||
      (cond
 | 
			
		||||
       ;; Skip colon and read value.
 | 
			
		||||
       ((eqv? ch #\:)
 | 
			
		||||
        (read-char port)
 | 
			
		||||
        (cons key (json-read port null ordered)))
 | 
			
		||||
       ;; Anything other than colon is an error.
 | 
			
		||||
       (else (json-exception port))))))
 | 
			
		||||
 | 
			
		||||
(define (json-read-object port null ordered)
 | 
			
		||||
  (expect-delimiter port #\{)
 | 
			
		||||
  (let loop ((pairs '()) (added #t))
 | 
			
		||||
    (skip-whitespaces port)
 | 
			
		||||
    (let ((ch (peek-char port)))
 | 
			
		||||
      (cond
 | 
			
		||||
       ;; End of object.
 | 
			
		||||
       ((eqv? ch #\})
 | 
			
		||||
        (read-char port)
 | 
			
		||||
        (cond
 | 
			
		||||
         (added (if ordered (reverse! pairs) pairs))
 | 
			
		||||
         (else (json-exception port))))
 | 
			
		||||
       ;; Read one pair and continue.
 | 
			
		||||
       ((eqv? ch #\")
 | 
			
		||||
        (let ((pair (read-pair port null ordered)))
 | 
			
		||||
          (loop (cons pair pairs) #t)))
 | 
			
		||||
       ;; Skip comma and read more pairs.
 | 
			
		||||
       ((eqv? ch #\,)
 | 
			
		||||
        (read-char port)
 | 
			
		||||
        (cond
 | 
			
		||||
         (added (loop pairs #f))
 | 
			
		||||
         (else (json-exception port))))
 | 
			
		||||
       ;; Invalid object.
 | 
			
		||||
       (else (json-exception port))))))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Array parsing helpers
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (json-read-array port null ordered)
 | 
			
		||||
  (expect-delimiter port #\[)
 | 
			
		||||
  (skip-whitespaces port)
 | 
			
		||||
  (cond
 | 
			
		||||
   ;; Special case when array is empty.
 | 
			
		||||
   ((eqv? (peek-char port) #\])
 | 
			
		||||
    (read-char port)
 | 
			
		||||
    #())
 | 
			
		||||
   (else
 | 
			
		||||
    ;; Read first element in array.
 | 
			
		||||
    (let loop ((values (list (json-read port null ordered))))
 | 
			
		||||
      (skip-whitespaces port)
 | 
			
		||||
      (let ((ch (peek-char port)))
 | 
			
		||||
        (cond
 | 
			
		||||
         ;; Unexpected EOF.
 | 
			
		||||
         ((eof-object? ch) (json-exception port))
 | 
			
		||||
         ;; Handle comma (if there's a comma there should be another element).
 | 
			
		||||
         ((eqv? ch #\,)
 | 
			
		||||
          (read-char port)
 | 
			
		||||
          (loop (cons (json-read port null ordered) values)))
 | 
			
		||||
         ;; End of array.
 | 
			
		||||
         ((eqv? ch #\])
 | 
			
		||||
          (read-char port)
 | 
			
		||||
          (list->vector (reverse! values)))
 | 
			
		||||
         ;; Anything else other than comma and end of array is wrong.
 | 
			
		||||
         (else (json-exception port))))))))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; String parsing helpers
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (read-hex-digit->integer port)
 | 
			
		||||
  (let ((ch (read-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((eqv? ch #\0) 0)
 | 
			
		||||
     ((eqv? ch #\1) 1)
 | 
			
		||||
     ((eqv? ch #\2) 2)
 | 
			
		||||
     ((eqv? ch #\3) 3)
 | 
			
		||||
     ((eqv? ch #\4) 4)
 | 
			
		||||
     ((eqv? ch #\5) 5)
 | 
			
		||||
     ((eqv? ch #\6) 6)
 | 
			
		||||
     ((eqv? ch #\7) 7)
 | 
			
		||||
     ((eqv? ch #\8) 8)
 | 
			
		||||
     ((eqv? ch #\9) 9)
 | 
			
		||||
     ((or (eqv? ch #\A) (eqv? ch #\a)) 10)
 | 
			
		||||
     ((or (eqv? ch #\B) (eqv? ch #\b)) 11)
 | 
			
		||||
     ((or (eqv? ch #\C) (eqv? ch #\c)) 12)
 | 
			
		||||
     ((or (eqv? ch #\D) (eqv? ch #\d)) 13)
 | 
			
		||||
     ((or (eqv? ch #\E) (eqv? ch #\e)) 14)
 | 
			
		||||
     ((or (eqv? ch #\F) (eqv? ch #\f)) 15)
 | 
			
		||||
     (else (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
(define (read-unicode-value port)
 | 
			
		||||
  (+ (* 4096 (read-hex-digit->integer port))
 | 
			
		||||
      (* 256 (read-hex-digit->integer port))
 | 
			
		||||
      (* 16 (read-hex-digit->integer port))
 | 
			
		||||
      (read-hex-digit->integer port)))
 | 
			
		||||
 | 
			
		||||
;; Unicode codepoint with surrogates is:
 | 
			
		||||
;;   10000 + (high - D800) + (low - DC00)
 | 
			
		||||
;; which is equivalent to:
 | 
			
		||||
;;  (high << 10) + low - 35FDC00
 | 
			
		||||
;; see
 | 
			
		||||
;;   https://github.com/aconchillo/guile-json/issues/58#issuecomment-662744070
 | 
			
		||||
(define (json-surrogate-pair->unicode high low)
 | 
			
		||||
  (+ (* high #x400) low #x-35FDC00))
 | 
			
		||||
 | 
			
		||||
(define (read-unicode-char port)
 | 
			
		||||
  (let ((codepoint (read-unicode-value port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ;; Surrogate pairs. `codepoint` already contains the higher surrogate
 | 
			
		||||
     ;; (between D800 and DC00) . At this point we are expecting another
 | 
			
		||||
     ;; \uXXXX that holds the lower surrogate (between DC00 and DFFF).
 | 
			
		||||
     ((and (>= codepoint #xD800) (< codepoint #xDC00))
 | 
			
		||||
      (expect-string port "\\u" #f)
 | 
			
		||||
      (let ((low-surrogate (read-unicode-value port)))
 | 
			
		||||
        (if (and (>= low-surrogate #xDC00) (< low-surrogate #xE000))
 | 
			
		||||
            (integer->char (json-surrogate-pair->unicode codepoint low-surrogate))
 | 
			
		||||
            (json-exception port))))
 | 
			
		||||
     ;; Reserved for surrogates (we just need to check starting from the low
 | 
			
		||||
     ;; surrogates).
 | 
			
		||||
     ((and (>= codepoint #xDC00) (< codepoint #xE000))
 | 
			
		||||
      (json-exception port))
 | 
			
		||||
     (else (integer->char codepoint)))))
 | 
			
		||||
 | 
			
		||||
(define (read-control-char port)
 | 
			
		||||
  (let ((ch (read-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ((eqv? ch #\") #\")
 | 
			
		||||
     ((eqv? ch #\\) #\\)
 | 
			
		||||
     ((eqv? ch #\/) #\/)
 | 
			
		||||
     ((eqv? ch #\b) #\bs)
 | 
			
		||||
     ((eqv? ch #\f) #\ff)
 | 
			
		||||
     ((eqv? ch #\n) #\lf)
 | 
			
		||||
     ((eqv? ch #\r) #\cr)
 | 
			
		||||
     ((eqv? ch #\t) #\ht)
 | 
			
		||||
     ((eqv? ch #\u) (read-unicode-char port))
 | 
			
		||||
     (else (json-exception port)))))
 | 
			
		||||
 | 
			
		||||
(define (json-read-string port)
 | 
			
		||||
  (expect-delimiter port #\")
 | 
			
		||||
  (let loop ((chars '()) (ch (read-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ;; Unexpected EOF.
 | 
			
		||||
     ((eof-object? ch) (json-exception port))
 | 
			
		||||
     ;; Unescaped control characters are not allowed.
 | 
			
		||||
     ((control-char? ch) (json-exception port))
 | 
			
		||||
     ;; End of string.
 | 
			
		||||
     ((eqv? ch #\") (reverse-list->string chars))
 | 
			
		||||
     ;; Escaped characters.
 | 
			
		||||
     ((eqv? ch #\\)
 | 
			
		||||
      (loop (cons (read-control-char port) chars) (read-char port)))
 | 
			
		||||
     ;; All other characters.
 | 
			
		||||
     (else
 | 
			
		||||
      (loop (cons ch chars) (read-char port))))))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Booleans and null parsing helpers
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (json-read-true port)
 | 
			
		||||
  (expect-string port "true" #t))
 | 
			
		||||
 | 
			
		||||
(define (json-read-false port)
 | 
			
		||||
  (expect-string port "false" #f))
 | 
			
		||||
 | 
			
		||||
(define (json-read-null port null)
 | 
			
		||||
  (expect-string port "null" null))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Main parser functions
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define (json-read port null ordered)
 | 
			
		||||
  (skip-whitespaces port)
 | 
			
		||||
  (let ((ch (peek-char port)))
 | 
			
		||||
    (cond
 | 
			
		||||
     ;; Unexpected EOF.
 | 
			
		||||
     ((eof-object? ch) (json-exception port))
 | 
			
		||||
     ;; Read JSON values.
 | 
			
		||||
     ((eqv? ch #\t) (json-read-true port))
 | 
			
		||||
     ((eqv? ch #\f) (json-read-false port))
 | 
			
		||||
     ((eqv? ch #\n) (json-read-null port null))
 | 
			
		||||
     ((eqv? ch #\{) (json-read-object port null ordered))
 | 
			
		||||
     ((eqv? ch #\[) (json-read-array port null ordered))
 | 
			
		||||
     ((eqv? ch #\") (json-read-string port))
 | 
			
		||||
     ;; Anything else should be a number.
 | 
			
		||||
     (else (json-read-number port)))))
 | 
			
		||||
 | 
			
		||||
;;
 | 
			
		||||
;; Public procedures
 | 
			
		||||
;;
 | 
			
		||||
 | 
			
		||||
(define* (json->scm #:optional (port (current-input-port))
 | 
			
		||||
                    #:key (null 'null) (ordered #f) (concatenated #f))
 | 
			
		||||
  "Parse a JSON document into native. Takes one optional argument,
 | 
			
		||||
@var{port}, which defaults to the current input port from where the JSON
 | 
			
		||||
document is read. It also takes a few of keyword arguments: @{null}: value for
 | 
			
		||||
JSON's null, it defaults to the 'null symbol, @{ordered} to indicate whether
 | 
			
		||||
JSON objects order should be preserved or not (the default) and @{concatenated}
 | 
			
		||||
which can be used to tell the parser that more JSON documents might come after a
 | 
			
		||||
properly parsed document."
 | 
			
		||||
  (let loop ((value (json-read port null ordered)))
 | 
			
		||||
    ;; Skip any trailing whitespaces.
 | 
			
		||||
    (skip-whitespaces port)
 | 
			
		||||
    (cond
 | 
			
		||||
     ;; If we reach the end the parsing succeeded.
 | 
			
		||||
     ((eof-object? (peek-char port)) value)
 | 
			
		||||
     ;; If there's anything else other than the end, check if user wants to keep
 | 
			
		||||
     ;; parsing concatenated valid JSON documents, otherwise parser fails.
 | 
			
		||||
     (else
 | 
			
		||||
      (cond (concatenated value)
 | 
			
		||||
            (else (json-exception port)))))))
 | 
			
		||||
 | 
			
		||||
(define* (json-string->scm str #:key (null 'null) (ordered #f))
 | 
			
		||||
  "Parse a JSON document into native. Takes a string argument,
 | 
			
		||||
@var{str}, that contains the JSON document. It also takes a couple of keyword
 | 
			
		||||
argument: @{null}: value for JSON's null, it defaults to the 'null symbol and
 | 
			
		||||
@{ordered} to indicate whether JSON objects order should be preserved or
 | 
			
		||||
not (the default)."
 | 
			
		||||
  (call-with-input-string str (lambda (p) (json->scm p #:null null #:ordered ordered))))
 | 
			
		||||
 | 
			
		||||
(define* (json-seq->scm #:optional (port (current-input-port))
 | 
			
		||||
                        #:key (null 'null) (ordered #f)
 | 
			
		||||
                        (handle-truncate 'skip) (truncated-object 'truncated))
 | 
			
		||||
  "Lazy parse a JSON text sequence from the port @var{port}.
 | 
			
		||||
This procedure returns a stream of parsed documents. The optional argument
 | 
			
		||||
@var{port} defines the port to read from and defaults to the current input
 | 
			
		||||
port. It also takes a few keyword arguments: @{null}: value for JSON's null
 | 
			
		||||
(defaults to the 'null symbol), @{ordered} to indicate whether JSON objects
 | 
			
		||||
order should be preserved or not (the default), @{handle-truncate}: defines how
 | 
			
		||||
to handle data loss, @{truncated-object}: used to replace unparsable
 | 
			
		||||
objects. Allowed values for @{handle-truncate} argument are 'throw (throw an
 | 
			
		||||
exception), 'stop (stop parsing and end the stream), 'skip (default, skip
 | 
			
		||||
corrupted fragment and return the next entry), 'replace (skip corrupted fragment
 | 
			
		||||
and return @{truncated-object} instead)."
 | 
			
		||||
  (letrec ((handle-truncation
 | 
			
		||||
            (case handle-truncate
 | 
			
		||||
              ((throw) json-exception)
 | 
			
		||||
              ((stop) (const (eof-object)))
 | 
			
		||||
              ((skip)
 | 
			
		||||
               (lambda (port)
 | 
			
		||||
                 (read-delimited "\x1e" port 'peek)
 | 
			
		||||
                 (read-entry port)))
 | 
			
		||||
              ((replace)
 | 
			
		||||
               (lambda (port)
 | 
			
		||||
                 (read-delimited "\x1e" port 'peek)
 | 
			
		||||
                 truncated-object))))
 | 
			
		||||
           (read-entry
 | 
			
		||||
            (lambda (port)
 | 
			
		||||
              (let ((ch (read-char port)))
 | 
			
		||||
                (cond
 | 
			
		||||
                 ((eof-object? ch) ch)
 | 
			
		||||
                 ((not (eqv? ch #\rs))
 | 
			
		||||
                  (handle-truncation port))
 | 
			
		||||
                 (else
 | 
			
		||||
                  (skip-record-separators port)
 | 
			
		||||
                  (catch 'json-invalid
 | 
			
		||||
                    (lambda ()
 | 
			
		||||
                      (let ((next (json-read port null ordered)))
 | 
			
		||||
                        (if (eqv? #\lf (peek-char port))
 | 
			
		||||
                            (begin
 | 
			
		||||
                              (read-char port)
 | 
			
		||||
                              next)
 | 
			
		||||
                            (handle-truncation port))))
 | 
			
		||||
                    (lambda (_ port)
 | 
			
		||||
                      (handle-truncation port)))))))))
 | 
			
		||||
    (port->stream port read-entry)))
 | 
			
		||||
 | 
			
		||||
(define* (json-seq-string->scm str #:key (null 'null) (ordered #f)
 | 
			
		||||
                               (handle-truncate 'skip) (truncated-object 'truncated))
 | 
			
		||||
  "Lazy parse a JSON text sequence from the string @var{str}.
 | 
			
		||||
This procedure returns a stream of parsed documents and also takes the same
 | 
			
		||||
keyword arguments as @code{json-seq->scm}."
 | 
			
		||||
  (call-with-input-string str
 | 
			
		||||
    (lambda (p)
 | 
			
		||||
      (json-seq->scm p #:null null #:ordered ordered
 | 
			
		||||
                     #:handle-truncate handle-truncate
 | 
			
		||||
                     #:truncated-object truncated-object))))
 | 
			
		||||
 | 
			
		||||
;;; (json parser) ends here
 | 
			
		||||
							
								
								
									
										22
									
								
								legacy-lilypond-compatibility-pre-2.25.ly
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								legacy-lilypond-compatibility-pre-2.25.ly
									
									
									
									
									
										Normal 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))
 | 
			
		||||
}
 | 
			
		||||
@@ -17,7 +17,7 @@ output = #(if (not noStandaloneOutput)
 | 
			
		||||
    \TEXT
 | 
			
		||||
 | 
			
		||||
    \score {
 | 
			
		||||
      \unfoldRepeats \MUSIC
 | 
			
		||||
      \unfoldRepeats { \MUSIC \INLINESCOREMUSIC }
 | 
			
		||||
      \midi {
 | 
			
		||||
        \context {
 | 
			
		||||
          \Score
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ songChordFontSeries = #'bold
 | 
			
		||||
songTextChordAlignment = #'left
 | 
			
		||||
songScoreChordFontSize = 2
 | 
			
		||||
songTextChordFontSize = 2
 | 
			
		||||
songTextLineHeigth = 5
 | 
			
		||||
songTextLineHeigth = 5.3
 | 
			
		||||
songInfoPoetAndComposerStacked = ##t
 | 
			
		||||
songTocColumns = 2
 | 
			
		||||
globalSize = 14
 | 
			
		||||
 
 | 
			
		||||
@@ -44,14 +44,7 @@
 | 
			
		||||
     (ly:make-stencil
 | 
			
		||||
      (list 'embedded-ps
 | 
			
		||||
             (ly:format
 | 
			
		||||
              "[/Action /GoTo /View [/Fit] /Title <~a> /OUT pdfmark"
 | 
			
		||||
               (fold
 | 
			
		||||
                (lambda (ch hexout)
 | 
			
		||||
                  (string-append hexout
 | 
			
		||||
                   (format #f "~2,'0x" (char->integer ch))))
 | 
			
		||||
                 ""
 | 
			
		||||
                 (string->list
 | 
			
		||||
                   (pdf-encode title)))))
 | 
			
		||||
              "[/Action /GoTo /View [/Fit] /Title (~a) /OUT pdfmark" (pdf-encode title)))
 | 
			
		||||
      empty-interval empty-interval
 | 
			
		||||
      ;'(0 . 0) '(0 . 0)
 | 
			
		||||
      ))
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
\include "../lilypond-custom-includes/toc_config.ly"
 | 
			
		||||
 | 
			
		||||
% embed all category images in postscript once
 | 
			
		||||
#(define-markup-list-command (embed-category-images layout props)()
 | 
			
		||||
   (map (lambda (category)
 | 
			
		||||
@@ -19,13 +21,20 @@
 | 
			
		||||
        (map (lambda (foo)
 | 
			
		||||
         (make-general-align-markup Y UP (make-override-markup '(baseline-skip . 1) (make-column-markup
 | 
			
		||||
          (let add-to-col ((lines restlines) (height-left height))
 | 
			
		||||
            (let* ((finished (null? lines))
 | 
			
		||||
                   (linestencil (if (not finished) (interpret-markup layout (cons (list (cons 'line-width line-width) (cons 'baseline-skip 1)) props) (markup #:center-align (car lines)))))
 | 
			
		||||
                   (calc-height (- height-left (if finished 0 (interval-length (ly:stencil-extent linestencil Y))))))
 | 
			
		||||
              (set! restlines lines)
 | 
			
		||||
              (if (or (< calc-height 0) (null? lines))
 | 
			
		||||
                (list)
 | 
			
		||||
                (cons (markup #:stencil linestencil) (add-to-col (cdr lines) calc-height)))))))))
 | 
			
		||||
            (set! restlines lines)
 | 
			
		||||
            (if (null? lines)
 | 
			
		||||
              '()
 | 
			
		||||
              (let* ((line-to-stencil (lambda (line) (interpret-markup layout (cons (list (cons 'line-width line-width) (cons 'baseline-skip 1)) props) (markup line))))
 | 
			
		||||
                     (stencil-height (lambda (stencil) (interval-length (ly:stencil-extent stencil Y))))
 | 
			
		||||
                     (linestencil (line-to-stencil (car lines)))
 | 
			
		||||
                     (current-line-height (stencil-height linestencil))
 | 
			
		||||
                     (new-height-left (- height-left current-line-height))
 | 
			
		||||
                     (next-line-height (if (null? (cdr lines)) current-line-height (stencil-height (line-to-stencil (cadr lines)))))
 | 
			
		||||
                     (no-space-for-next-line (and (< next-line-height current-line-height) (< new-height-left next-line-height)))
 | 
			
		||||
                     )
 | 
			
		||||
                (if (or (< new-height-left 0) no-space-for-next-line)
 | 
			
		||||
                  '()
 | 
			
		||||
                  (cons (markup #:stencil linestencil) (add-to-col (cdr lines) new-height-left))))))))))
 | 
			
		||||
          (make-list cols))))
 | 
			
		||||
     (if (null? restlines)
 | 
			
		||||
         (list)
 | 
			
		||||
@@ -164,17 +173,7 @@
 | 
			
		||||
                           (cdr revlist)))))))))
 | 
			
		||||
 | 
			
		||||
\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
 | 
			
		||||
  }
 | 
			
		||||
  indexTitleMarkup = \tocSubtitleText
 | 
			
		||||
  categoryTitleMarkup = \markup \column {
 | 
			
		||||
    \fontsize #5 \sans \bold \fill-line { \null \fromproperty #'index:text \null }
 | 
			
		||||
    \vspace #1
 | 
			
		||||
@@ -182,8 +181,8 @@
 | 
			
		||||
  indexItemMarkup = \markup \with-link-symbol-ref #'index:label {
 | 
			
		||||
    \index-item-with-pattern
 | 
			
		||||
  }
 | 
			
		||||
  indexSectionMarkup = \markup \override #'(baseline-skip . 1.5) \column {
 | 
			
		||||
    \fill-line { \sans \bold \fontsize #3 \fromproperty #'index:text \null }
 | 
			
		||||
  indexSectionMarkup = \markup \override #'(baseline-skip . 1.5) \left-column {
 | 
			
		||||
    \sans \bold \fontsize #3 \fromproperty #'index:text
 | 
			
		||||
    \null
 | 
			
		||||
  }
 | 
			
		||||
  indexCategoryMarkup = \markup \override #'(baseline-skip . 1.5) \column {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +1,13 @@
 | 
			
		||||
% guile regular expressions aktivieren:
 | 
			
		||||
#(use-modules (ice-9 regex))
 | 
			
		||||
 | 
			
		||||
% parsing line by line
 | 
			
		||||
#(define-markup-command (wrap-newline layout props text) (string?)
 | 
			
		||||
   "Text Zeile für Zeile parsen"
 | 
			
		||||
   (interpret-markup layout props
 | 
			
		||||
     #{ \markup { \column {
 | 
			
		||||
     $(let ((verse-markup-string (string-append "\\line { "
 | 
			
		||||
            (regexp-substitute/global #f "\n"
 | 
			
		||||
               text
 | 
			
		||||
             'pre " } \\line { " 'post )
 | 
			
		||||
     $(let ((verse-markup-string (
 | 
			
		||||
        string-append "\\line { "
 | 
			
		||||
          (ly:regex-replace (ly:make-regex "\n") text " } \\line { ")
 | 
			
		||||
          " \\size-box-to-box ##f ##t \"\" \"Agj\" }" )))
 | 
			
		||||
       ;(ly:parse-string-expression (if (< (list-ref (ly:version) 1) 19) (ly:parser-clone parser) (ly:parser-clone)) verse-markup-string))
 | 
			
		||||
       (if (< (list-ref (ly:version) 1) 19) (ly:parser-include-string parser verse-markup-string) (ly:parser-include-string verse-markup-string)))
 | 
			
		||||
       (ly:parser-include-string verse-markup-string))
 | 
			
		||||
     }}#}
 | 
			
		||||
   )
 | 
			
		||||
)
 | 
			
		||||
@@ -108,26 +103,28 @@
 | 
			
		||||
 | 
			
		||||
% Kompletten Vers mit Akkorden
 | 
			
		||||
#(define-markup-command (chordverse layout props stanza verse) (markup? string?)
 | 
			
		||||
   #:properties ((intraverse-vspace 0))
 | 
			
		||||
   "Vers mit Akkorden"
 | 
			
		||||
   (let* ((fromto (chain-assoc-get 'transposition props #f))
 | 
			
		||||
          (transp (if fromto
 | 
			
		||||
                    (string-append "\\transpose " (car fromto) " " (cdr fromto))
 | 
			
		||||
                    "")))
 | 
			
		||||
   (interpret-markup layout props
 | 
			
		||||
     (markup #:override `(baseline-skip . ,songTextLineHeigth) #:anchor-x-between #:stanza stanza
 | 
			
		||||
     (markup #:override `(baseline-skip . ,(+ intraverse-vspace songTextLineHeigth)) #:anchor-x-between #:stanza stanza
 | 
			
		||||
       (make-wrap-newline-markup
 | 
			
		||||
               (regexp-substitute/global #f "\\(( *)([^,()]*)( *),([^)]*)\\)"
 | 
			
		||||
                 (regexp-substitute/global #f "(([^ \n]*\\([^()]*\\)[^ \n]*)+)" verse
 | 
			
		||||
                                         'pre " \\concat { " 1 " } " 'post)
 | 
			
		||||
                'pre "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }" 'post))
 | 
			
		||||
               (ly:regex-replace (ly:make-regex "\\(( *)([^,()]*)( *),([^)]*)\\)")
 | 
			
		||||
                 (ly:regex-replace (ly:make-regex "(([^ \n]*\\([^()]*,[^()]+\\)[^ \n(]*)+)") verse " \\concat { " 1 " } ")
 | 
			
		||||
                "\\textup \\line { \"" 1 "\" " 2 " \"" 3 "\" } \\score { \\transposable " transp " \\chords { s4 " 4 " } \\layout { \\verseChordLayout } }")
 | 
			
		||||
                )
 | 
			
		||||
     ))))
 | 
			
		||||
 | 
			
		||||
% Kompletter Vers aus dem Akkorde entfernt werden
 | 
			
		||||
#(define-markup-command (nochordverse layout props stanza verse) (markup? string?)
 | 
			
		||||
   #:properties ((intraverse-vspace 0))
 | 
			
		||||
   "Vers ohne Akkorde"
 | 
			
		||||
   (interpret-markup layout props
 | 
			
		||||
     (markup #:override '(baseline-skip . 3.0) #:anchor-x-between #:stanza stanza
 | 
			
		||||
           #:wrap-newline (regexp-substitute/global #f "\\(([^,]*),([^)]*)\\)" verse 'pre 1 'post )
 | 
			
		||||
     (markup #:override `(baseline-skip . ,(+ intraverse-vspace 3.0)) #:anchor-x-between #:stanza stanza
 | 
			
		||||
           #:wrap-newline (ly:regex-replace (ly:make-regex "\\(([^,]*),([^)]*)\\)") verse 1)
 | 
			
		||||
     )
 | 
			
		||||
   )
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user