[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

convert-ly rules: word boundaries

From: Graham Percival
Subject: convert-ly rules: word boundaries
Date: Sat, 4 Jul 2009 01:58:21 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

(cleaning up old emails)

This looks sub-optimal:
def conv (str):
    str = re.sub (r"\\octave(?![a-zA-Z])", r"\\octaveCheck", str)
    str = re.sub (r"arpeggioUp", r"arpeggioArrowUp", str)
    str = re.sub (r"arpeggioDown", r"arpeggioArrowDown", str)

arpeggio* should have \\ as well.  Also, they should also be
matched with full words.  In fact, 99% of the convert-ly rules
need to match a complete word.  According to Daniel Hulme,
"\\octave\b" would work fine.

1)  Could somebody verify this (look in the python docs, run a few
tests, whatever... not that I doubt Daniel; just that we should
make sure).

2)  Could somebody consider writing a nicely-named-function such
that the convert-ly rules look like this?

def conv (str):
    str = f("\\oldCommand", "\\newCommand", str)

It's silly for people to manually add \b everywhere, and it's
equally silly for contributors to say "oh, I can't touch
convert-ly, since I don't know python".  Let's make it easy to
write/modify those rules.

- Graham

reply via email to

[Prev in Thread] Current Thread [Next in Thread]