Am 14.10.25 um 10:49 schrieb Richard Shann:
On Mon, 2025-10-13 at 19:12 +0200, Andreas Schneider wrote:
Thank you very much, this creates basically what I need. Only a
slight
inconvenience is that I need to re-run the script every time I change
a
title.
I recall that having an attribute "dynamic" that was supposed to
trigger recalculations, but I'm not sure that went anywhere. There are
a number of such things - Upbeat for example...
That markup is inserted into titles upon edit is annoying.
So here is a fix for the toc:

[...]

Unfortunately, I get a script error:

A script error for file/script (use-modules (ice-9 string-fun))
                   (d-PushPosition)
                   (while (d-PreviousMovement))

                   (let ((tag "SimpleToc"))
(d-DirectivePut-paper-postfix tag "tocItemMarkup = \\tocItemWithDotsMarkup") (d-DirectivePut-score-prefix tag "\\markuplist \\table-of-contents\n")
                        (let loop ()
                                (define title (d-DirectiveGet-header-data 
"MTitles"))
                                (if title
                                        (begin
                                                (set! title (assq-ref 
(eval-string title) 'title))
                                                (if title
                                                        (begin
(set! title (string-replace-substring title "\\column{" "")) (set! title (string-replace-substring title "\\line{" "")) (set! title (string-replace-substring title "}" "")) (d-DirectivePut-movementcontrol-prefix tag (string-append "\\tocItem \\markup \"" title "\"\n"))) (d-WarningDialog (_ "No title for this movement")))) (d-WarningDialog (_ "No (simple) titles for this movement")))
                                (if (d-NextMovement)
                                        (loop))))
                   (d-PopPosition)              
                   ; the throw arguments are

(#f Unbound variable: ~S (string-replace-substring) #f)

What does work is to advanced-edit the movement titles and delete the markup in postfix and scheme data.

Andreas


Reply via email to