|
From: | Michael Käppler |
Subject: | Re: convert-ly for note/rest-markup |
Date: | Thu, 11 Feb 2021 23:54:01 +0100 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 |
Am 11.02.2021 um 23:39 schrieb Aaron Hill:
On 2021-02-11 2:04 pm, David Kastrup wrote:Short of special-patterning the known exceptions... a bit of a nightmare.Does the pattern matching need to be so particular about context? Consider a primitive approach: re.sub(r'\\note\s*#"([^"]+)"', r"\\note { \g<1> }", ...) This matches the `\note #"..."` pattern, converting to `\note { ... }`.
I agree that this should work for most cases, but consider that it can't be taken for granted that '\note' refers to the markup function: %%%%%%%%%%%%%%%% note = { c4 } \markup \note #"4." #UP \note #"4." #UP %%%%%%%%%%%%%%%% I don't want to say it makes any sense, but it is valid input... Michael
-- Aaron Hill
[Prev in Thread] | Current Thread | [Next in Thread] |