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


Reply via email to