Michael Käppler <xmichae...@web.de> writes: > 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?
Short of special-patterning the known exceptions... a bit of a nightmare. -- David Kastrup