lilypond-devel
[Top][All Lists]
Advanced

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

Re: another convert-ly problem


From: Erik Sandberg
Subject: Re: another convert-ly problem
Date: Fri, 9 Apr 2004 11:31:03 +0200
User-agent: KMail/1.5.4

On Wednesday 07 April 2004 16.43, Han-Wen Nienhuys wrote:
> address@hidden writes:
> > On Saturday 27 March 2004 23.42, Han-Wen Nienhuys wrote:
> > > address@hidden writes:
> > > > > Yes it would, but how would you parse a balanced parenthesis
> > > > > expression using regular expressions?
> > > >
> > > > I know my automata theory, but when thinking about it once again,
> > > > there is really a solution. (DON'T LAUGH! READ ON)
> > > >
> > > > There are 318 pieces of music on Mutopia only, which were typeset
> > > > with v1.8 and earlier. In most cases, the "balanced parenthesis
> > > > expressions" consist of
> > > > [..]
> > >
> > > Very good ideas, indeed! I would welcome a patch that implements this.
> >
> > Allright, this patch fixes the most basic text markups; those on the form
> > #'(foo "bar") or the special case for segno, #'(music "bla"), either as
> > \mark or [_-^].
> >
> > I'm not familiar with python, and even less with re.sub, so i wasn't able
> > to do any more advanced regexp stuff.
>
> Have you verified that this does not break other things?

I tried it on the Gimo collection, it works fine.

It's quite safe; if two (:s are found, then nothing will be done. I can see 2 
cases where it will do an illegal conversion:
- A musicglyph with \" in its name (doesnt happen)
- A text markup string containing a ")" without a preceding "(". Which is 
pretty obscure.
my conversion rules will skip the conversion unless it really looks much like 
a simple case.

The following cases are handled:
\version "1.8.0"
\score {\notes {
c-#'(italic "foo") b b
a^#'(italic foo) b b
d_#'(bold "foo  ffds") b b
e-#'(music "scripts-segno") d d 
e_#'(italic Foo bar) b b
e\mark #'(italic ff) d f
e\mark #'(music "scripts-segno") d d
}}

> (BTW, can you attach patches? your mailer is wrapping lines)

Yes. I just assumed that attachments are stripped, but apparently, on 
lily-devel they aren't.

Attached is a new version (the previous one missed cases 2,5,6 above). I 
suppose it should be applied both to the 2.2 and 2.3 branches.

It also includes a few commenting fixes in the same script.

Erik


Attachment: markup-convert.diff
Description: Text Data


reply via email to

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