[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
v2.15.24: void-, scheme- or music-function in toc-section?
From: |
Thomas Morley |
Subject: |
v2.15.24: void-, scheme- or music-function in toc-section? |
Date: |
Mon, 16 Jan 2012 00:17:09 +0100 |
Hi,
I've tried to retrieve different table-of-content-sections (a normal
one, an alphabetical sorted and an alphabetical sorted index, showing
initial letters) all with three columns: piece, composer and page,
defining several new "toc-items": abcTocItem, indexItem, indexSection
and customTocItem etc.
So far it works fine.
But it's a lot of typing in the file. And because nearly all Items are
using equal arguments I tried to create a summarizing function:
\version "2.15.24"
% full code -> attached file
indexItems =
#(define-music-function (parser location text) (markup?)
(let* ((text-rev (if (string? text)
text
(markup->string text)))
(args (string-split text-rev #\#))
(initial (string-upcase (substring (car args) 0 1))))
#{
\abcTocItem $text-rev
\indexItem $text-rev
\indexSection $initial
\customTocItem $text-rev
#}))
But now the page-numbers aren't printed and the link doesn't work!
And a log-warning: no music found in score
Also, I tried:
indexItems =
#(define-music-function (parser location text) (markup?)
(let* ((text-rev (if (string? text)
text
(markup->string text)))
(args (string-split text-rev #\#))
(initial (string-upcase (substring (car args) 0 1))))
(begin
(add-abctoc-item! 'abcTocItemMarkup text-rev)
(add-index-item! 'indexItemMarkup text-rev)
(add-index-item! 'indexSectionMarkup initial)
(add-customtoc-item! 'customTocItemMarkup text-rev)
)))
No warning, but only the last setting (add-customtoc-item!
'customTocItemMarkup text-rev) works.
define-void-function or define-scheme-function seems not to work, too.
Any hint?
Cheers,
Harm
alphabetical-index-06.ly
Description: Text Data
alphabetical-index-06.pdf
Description: Adobe PDF document
- v2.15.24: void-, scheme- or music-function in toc-section?,
Thomas Morley <=