use starttext and better PDF bookmarks

This commit is contained in:
tux 2024-12-01 15:48:25 +01:00
parent db26306b5b
commit c4f3a3c196
2 changed files with 5 additions and 2 deletions

View File

@ -48,8 +48,9 @@
#(define-markup-command (title-with-category-images layout props right)(boolean?) #(define-markup-command (title-with-category-images layout props right)(boolean?)
(interpret-markup layout props (interpret-markup layout props
(let* ((title (chain-assoc-get 'header:title props #f)) (let* ((title (chain-assoc-get 'header:title props ""))
(pdfbookmark (chain-assoc-get 'header:songfilename props title))) (starttext (chain-assoc-get 'header:starttext props #f))
(pdfbookmark (if starttext (string-append starttext " | " title) title)))
(if title (if title
;(if (chain-assoc-get 'header:categories props #f) ;(if (chain-assoc-get 'header:categories props #f)
(if right (if right

View File

@ -233,6 +233,7 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s
(if (and extracted (not (string-null? extracted))) extracted #f) (if (and extracted (not (string-null? extracted))) extracted #f)
))) )))
(title (extract-var-and-check 'title)) (title (extract-var-and-check 'title))
(starttext (extract-var-and-check 'starttext))
(alttitle (extract-var-and-check 'alttitle)) (alttitle (extract-var-and-check 'alttitle))
(altalttitle (extract-var-and-check 'altalttitle)) (altalttitle (extract-var-and-check 'altalttitle))
(categorytitle (extract-var-and-check 'categorytitle)) (categorytitle (extract-var-and-check 'categorytitle))
@ -241,6 +242,7 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s
(add-index-item! 'indexItemMarkup tocmarkup toctitle label))) (add-index-item! 'indexItemMarkup tocmarkup toctitle label)))
) )
(if categories (add-category-index-item! (string-tokenize categories) 'indexItemMarkup (cons (list (cons 'rawtext (if categorytitle categorytitle title))) '()) label)) (if categories (add-category-index-item! (string-tokenize categories) 'indexItemMarkup (cons (list (cons 'rawtext (if categorytitle categorytitle title))) '()) label))
(if starttext (add-to-toc! starttext (cons (list (cons 'rawtext starttext) (cons 'alternative #t)) '())))
(if alttitle (add-to-toc! alttitle (cons (list (cons 'rawtext alttitle) (cons 'alternative #t)) '()))) (if alttitle (add-to-toc! alttitle (cons (list (cons 'rawtext alttitle) (cons 'alternative #t)) '())))
(if altalttitle (add-to-toc! altalttitle (cons (list (cons 'rawtext altalttitle) (cons 'alternative #t)) '()))) (if altalttitle (add-to-toc! altalttitle (cons (list (cons 'rawtext altalttitle) (cons 'alternative #t)) '())))
(if title (add-to-toc! title (cons (list (cons 'rawtext title)) '())) #{ #}) (if title (add-to-toc! title (cons (list (cons 'rawtext title)) '())) #{ #})