| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				@@ -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)
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -171,6 +173,11 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                           (cdr revlist)))))))))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				\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 {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    \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)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				   (map (lambda (index-item)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				         (let ((label (car index-item))
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -196,18 +225,33 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				             (ly:output-def-lookup layout index-markup))))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				       (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" )
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    (let ((items (case index-type
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            ((alphabetical) index-items)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            ((categories) category-index-items)))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				          (title (interpret-markup layout props title-markup)))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#(define-markup-list-command (colindex 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}" )
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      (let ((title (interpret-markup layout (cons (list (cons 'index:text "Inhaltsverzeichnis")) props)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        (ly:output-def-lookup layout 'indexTitleMarkup))))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        (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 items layout))))))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				      (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 =
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				#(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-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)
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				  (let ((variableref (assoc-ref module sym)))
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    (if variableref (variable-ref variableref) #f))
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				 
 |