|
From: | Aaron Hill |
Subject: | Re: A Javascript test code for modifying ties and slurs with mouse |
Date: | Sat, 14 Dec 2019 15:37:54 -0800 |
User-agent: | Roundcube Webmail/1.3.8 |
On 2019-12-14 6:16 am, Paolo Prete wrote:
However, how can I make it work for multiple pages output?
Another approach would be to modify how LilyPond generates SVG output, so that the script in question is inserted just before the closing </svg> element:
%%%% \version "2.19.83" svg-script = #(define-void-function (body) (string?) (let* ((mod (resolve-module '(scm framework-svg))) (svg-end (module-ref mod 'svg-end #f))) (if (procedure? svg-end) (module-define! mod 'svg-end (lambda () (string-join (list "<script type=\"text/javascript\"><![CDATA[" body "]]></script>" (svg-end)) "\n")))))) \svg-script #"// TODO: Insert script here." %%%%This is improved in that no \markup is required. This injection of content happens at a point after LilyPond has processed each page of music, so there are no unintended side-effects to the layout.
However, the above kludge modifies an undocumented, underlying mechanism. As such, this would be a case of "just because you can does not necessarily mean you should".
As has been suggested, perhaps the best option would be to post-process the SVG output from outside LilyPond.
-- Aaron Hill
[Prev in Thread] | Current Thread | [Next in Thread] |