Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OrchestralLily
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Edition Kainhofer
OrchestralLily
Commits
d15756b9
Commit
d15756b9
authored
12 years ago
by
Reinhold Kainhofer
Browse files
Options
Downloads
Patches
Plain Diff
Make the toc file work with bookparts, too
parent
1b94ab73
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
orchestrallily.ily
+15
-7
15 additions, 7 deletions
orchestrallily.ily
with
15 additions
and
7 deletions
orchestrallily.ily
+
15
−
7
View file @
d15756b9
...
@@ -830,12 +830,17 @@ keepcuefilter = #(define-music-function (parser location music) (ly:music?)
...
@@ -830,12 +830,17 @@ keepcuefilter = #(define-music-function (parser location music) (ly:music?)
removecuefilter = #(define-music-function (parser location music) (ly:music?)
removecuefilter = #(define-music-function (parser location music) (ly:music?)
((ly:music-function-extract removeWithTag) parser location 'cued ((ly:music-function-extract killCues) parser location music)))
((ly:music-function-extract removeWithTag) parser location 'cued ((ly:music-function-extract killCues) parser location music)))
%% The page numbers are pages counts in the pdf file, not visible page number!
%% So we have to offset them if the first page is not page #1
%% unfortunately this means we have to store the first-page-number of the first
%% bookpart in a global variable, because in later layouts we don't have that
%% information available any more (first-page-number will be the first page
%% number of the currently processed bookpart!)
#(define oly:first-page-offset #f)
#(define (oly:create-toc-file layout pages)
#(define (oly:create-toc-file layout pages)
(let* ((label-table (ly:output-def-lookup layout 'label-page-table))
(if (not oly:first-page-offset)
;; The page numbers are pages counts in the pdf file, not visible page number!
(set! oly:first-page-offset (1- (ly:output-def-lookup layout 'first-page-number))))
;; So we have to offset them if the first page is not page #1
(let* ((label-table (ly:output-def-lookup layout 'label-page-table)))
(first-page-offset (1- (ly:output-def-lookup layout 'first-page-number))))
(if (not (null? label-table))
(if (not (null? label-table))
(let* ((format-line (lambda (toc-item)
(let* ((format-line (lambda (toc-item)
(let* ((label (car toc-item))
(let* ((label (car toc-item))
...
@@ -843,9 +848,12 @@ removecuefilter = #(define-music-function (parser location music) (ly:music?)
...
@@ -843,9 +848,12 @@ removecuefilter = #(define-music-function (parser location music) (ly:music?)
(label-page (and (list? label-table)
(label-page (and (list? label-table)
(assoc label label-table)))
(assoc label label-table)))
(page (and label-page (cdr label-page))))
(page (and label-page (cdr label-page))))
(format #f "~a, section, 1, {~a}, ~a" (- page first-page-offset) text label))))
(if page
(format #f "~a, section, 1, {~a}, ~a" (- page oly:first-page-offset) text label)
;; label came from a different bookpart, so ignore it!
#f))))
(formatted-toc-items (map format-line (toc-items)))
(formatted-toc-items (map format-line (toc-items)))
(whole-string (string-join formatted-toc-items ",\n"))
(whole-string (string-join
(filter (lambda (i) i)
formatted-toc-items
)
",\n"))
(output-name (ly:parser-output-name parser))
(output-name (ly:parser-output-name parser))
(outfilename (format "~a.toc" output-name))
(outfilename (format "~a.toc" output-name))
(outfile (open-output-file outfilename)))
(outfile (open-output-file outfilename)))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment