[Top][All Lists]

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

Re: command_replace function (was: Re: difference betwwen \pad-around an

From: Carl Sorensen
Subject: Re: command_replace function (was: Re: difference betwwen \pad-around and \pad-markup?)
Date: Wed, 12 Aug 2009 21:01:22 -0600

On 8/12/09 12:31 PM, "Mark Polesky" <address@hidden> wrote:

> Carl Sorensen wrote:
>> 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.
> Yes, the idea was that the python function would add "\\" and "\b"
> appropriately, but at least one gotcha has been mentioned (by
> Neil):
> For each builtin markup-command, the define-builtin-markup-command
> macro (line 48 of markup.scm) generates a "make-COMMAND-markup",
> which wouldn't be converted if the rule mandates "\\".
> I presume that this wouldn't be a big deal to accommodate, but I
> have no idea how many other gotchas there are. This one is markup-
> specific, but I imagine there are plenty of other similar traps.
> Anyone have an idea how to find the other "traps"? Could there be
> a  systematic approach?

I think the best way to do this is to do the following:

0) Ask for any other ideas as to where the regexp wouldn't work.
1) Write the function, and take care of the make-COMMAND-markup rule.
2) Use the new function to write convert-ly rules
3) Look for any errors caused by the use of the convert-ly rules being
4) When the errors show up, do what is necessary to fix them.



reply via email to

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