From c2ed2d57df92ab5059abd5ad0213bd150507bbe7 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sat, 18 Apr 2009 18:17:50 +0200 Subject: [PATCH] Write TOC to the correct .toc file --- Documentation/orchestrallily.tely | 9 +++++++++ orchestrallily.ly | 11 ++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Documentation/orchestrallily.tely b/Documentation/orchestrallily.tely index 032a74e..9802b3c 100644 --- a/Documentation/orchestrallily.tely +++ b/Documentation/orchestrallily.tely @@ -657,6 +657,15 @@ these are defined in the include file oly_settings_names.ly: @lilypondfile[quote,verbatim,line-width=12\cm]{../testsuite/default-instrument-names.ly} +@node Creating a TOC file for the Latex includepdf call +@section Creating a TOC file for a includepdf call in @latex +TODO +@example +\paper { + #(define (page-post-process layout pages) (oly:create-toc-file layout pages)) +} +@end example + @node Non-standard staves diff --git a/orchestrallily.ly b/orchestrallily.ly index 50fe281..5289dc7 100644 --- a/orchestrallily.ly +++ b/orchestrallily.ly @@ -604,17 +604,18 @@ cuefilter = #(define-music-function (parser location music) (ly:music?) #(define (oly:create-toc-file layout pages) (let* ((label-table (ly:output-def-lookup layout 'label-page-table)) - (format-line (lambda (toc-item) + (format-line (lambda (toc-item) (let* ((label (car toc-item)) (text (caddr toc-item)) (label-page (and (list? label-table) (assoc label label-table))) (page (and label-page (cdr label-page)))) (format #f "~a, section, 1, {~a}, ~a" page text label)))) - (formatted-toc-items (map format-line (toc-items))) - (whole-string (string-join formatted-toc-items ",\n")) - (outfilename "text.toc");; TODO: Find out a way to get the output filename! - (outfile (open-output-file outfilename))) + (formatted-toc-items (map format-line (toc-items))) + (whole-string (string-join formatted-toc-items ",\n")) + (output-name (ly:parser-output-name parser)) + (outfilename (format "~a.toc" output-name)) + (outfile (open-output-file outfilename))) (if (output-port? outfile) (display whole-string outfile) (ly:warning (_ "Unable to open output file ~a for the TOC information") outfilename)) -- 2.11.4.GIT