[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: difference betwwen \pad-around and \pad-markup?
From: |
Carl Sorensen |
Subject: |
Re: difference betwwen \pad-around and \pad-markup? |
Date: |
Wed, 12 Aug 2009 11:32:05 -0600 |
str.replace is probably preferred for this particular example. str.*
functions use less overhead. But really, at the level we're using it in
convert-ly, it doesn't matter.
But you should probably really use something like
str = re.sub (r'\b\\pad-markup\b', r'\\pad-around', str)
Note- I haven't tested this expression, so it may not be right.
The object is to make sure you start the match and end the match on a word
boundary, and to make sure you include the \.
You don't want to change somebody's function call \special-lilypad-markup to
\special-lilypad-around.
Even better would be to define a function:
def command_replace(old_command, new_command, str)
that could then be used in a convert-ly rule
str = command_replace ("pad-markup", "pad-around", str)
so that in the future you'd never have to worry about dealing with word
boundaries, etc. This was something Graham asked for a couple of months
ago, but it never got added. If you wanted to do this as part of your
project, it would be great.
Thanks,
Carl
- Re: difference betwwen \pad-around and \pad-markup?, (continued)
- Re: difference betwwen \pad-around and \pad-markup?, Graham Percival, 2009/08/01
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, Neil Puttock, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, John Mandereau, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, Neil Puttock, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, John Mandereau, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, Carl Sorensen, 2009/08/11
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?,
Carl Sorensen <=
- command_replace function (was: Re: difference betwwen \pad-around and \pad-markup?), Mark Polesky, 2009/08/12
- Re: command_replace function (was: Re: difference betwwen \pad-around and \pad-markup?), Carl Sorensen, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Carl Sorensen, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Graham Percival, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Carl Sorensen, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Neil Puttock, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Mark Polesky, 2009/08/12
- Re: difference betwwen \pad-around and \pad-markup?, Neil Puttock, 2009/08/12