From c4f3a3c1969bb14ec5eceea26a52bc39cabade14 Mon Sep 17 00:00:00 2001 From: tux Date: Sun, 1 Dec 2024 15:48:25 +0100 Subject: [PATCH] use starttext and better PDF bookmarks --- title_with_category_images.ly | 5 +++-- toc_include.ly | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/title_with_category_images.ly b/title_with_category_images.ly index 4a89d8c..d3df852 100644 --- a/title_with_category_images.ly +++ b/title_with_category_images.ly @@ -48,8 +48,9 @@ #(define-markup-command (title-with-category-images layout props right)(boolean?) (interpret-markup layout props - (let* ((title (chain-assoc-get 'header:title props #f)) - (pdfbookmark (chain-assoc-get 'header:songfilename props title))) + (let* ((title (chain-assoc-get 'header:title props "")) + (starttext (chain-assoc-get 'header:starttext props #f)) + (pdfbookmark (if starttext (string-append starttext " | " title) title))) (if title ;(if (chain-assoc-get 'header:categories props #f) (if right diff --git a/toc_include.ly b/toc_include.ly index fd8d5de..f5ced87 100644 --- a/toc_include.ly +++ b/toc_include.ly @@ -233,6 +233,7 @@ headerToTOC = #(define-music-function (parser location header label) (ly:book? s (if (and extracted (not (string-null? extracted))) extracted #f) ))) (title (extract-var-and-check 'title)) + (starttext (extract-var-and-check 'starttext)) (alttitle (extract-var-and-check 'alttitle)) (altalttitle (extract-var-and-check 'altalttitle)) (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))) ) (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 altalttitle (add-to-toc! altalttitle (cons (list (cons 'rawtext altalttitle) (cons 'alternative #t)) '()))) (if title (add-to-toc! title (cons (list (cons 'rawtext title)) '())) #{ #})