|
From: | Michael Käppler |
Subject: | Re: convert-ly for note/rest-markup |
Date: | Thu, 11 Feb 2021 22:56:31 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
Am 03.02.2021 um 09:05 schrieb Michael Käppler:
Hi Harm, Am 02.02.2021 um 22:52 schrieb Thomas Morley:Hi, with e35b7959dfe the note-markup-command was changed to need a duration-argument, before it was a string. With, MR 627 "Revisit rest-markup-commands" https://gitlab.com/lilypond/lilypond/-/merge_requests/627 I attempt to do similar for the rest-markup-command. This change would need a convert-rule, imho. Alas, this is beyond my capabilities. Any volunteer? Btw, e35b7959dfe contains a convert-rule for the note-markup, though it does not seem to work.I had a quick look on this, the problem is not in e35b7959dfe, the regex 'matchfullmarkup' (see convertrules.py:3471) which is used in said commit assumes that \markup is followed by at least one set of braces. You can verify this by converting %%%%%%%%%%%%%% \version "2.18.2" \markup { \note #"4." #UP } %%%%%%%%%%%%%% which works as expected.
Unfortunately, I was wrong. The problem is a more fundamental one. 'matchfullmarkup' tries to match the full markup, but nothing more than that. In other words, it has to make assumptions where the \markup environment ends. In a case like \markup { ... } this is simple, because it can simply "wait" for the closing brace. However, when \markup is followed by a single markup command or a sequence of markup commands, like \markup \center-align \fontsize #2 "foo" this does not work. Instead it assumes that the \markup environment ends with a string or another set of balanced braces. For markup commands that do not take a markup as last argument, this will not work. The problem is not limited to \note, it would affect commands like \beam, \draw-circle etc. as well, if syntax conversions would have to be added to 'convert-ly'. AFAICT the parser solves this problem by checking the call signature of the markup command to know how many arguments should be there. (and of which type) Since \markup commands are user-definable, I don't have any idea how to solve this in a general way within convert-ly. Cc'ing David, maybe you have some inspiration for us? Michael
Cheers, MichaelUsing convert-ly from recent master, running over a file containing: %%%%%%%%%%%%%% \version "2.18.2" \markup \note #"4." #UP %%%%%%%%%%%%%% returns: convert-ly atest-107.ly convert-ly (GNU LilyPond) 2.23.1 convert-ly: Processing `atest-107.ly'... Applying conversion: 2.19.2, 2.19.7, 2.19.11, 2.19.16, 2.19.22, 2.19.24, 2.19.28, 2.19.29, 2.19.32, 2.19.39, 2.19.40, 2.19.46, 2.19.49, 2.20.0, 2.21.0, 2.21.2 \version "2.21.2" \markup \note #"4." #UP cc-ing David Thanks, Harm
[Prev in Thread] | Current Thread | [Next in Thread] |