Am Mittwoch, 31. Januar 2007 22:11 schrieb Uwe Stöhr:
>  >> What? The patch was wrong. It should have created a new format, and a
>  >> description in development/FORMAT.
> 
> I added a description to the FORMAT file now. (the change from 256 to 257 
made by Abdel yesterday is 
> not explained there)

Shame on me (it was me who originally forgot this) and Abdel (for not 
noticing). I'll make good for this as soon as I have some time.

> As you know I'm new in this field: Why was it necessary to increase the 
format from 257 to 258?

It is simple: Every change increases the format number. File format numbers 
are cheap (we store them in an int :-) ), and that ensures that people who 
test trunk seriously do not miss any lyx2lyx conversion. Without a format 
update documents that have been converted between the last format update 
and your lyxline change would miss the lyxline conversion.
Of course in this case the last format update was not long ago, but 
especially before a release we should be very picky about this. As long as 
we follow these rules we can even change the format shortly before the 
release with a very minimal risk of breaking something.

I have to say that I really like how lyx2lyx works: We don't need to keep 
compatibility code in LyX, but can still handle old documents well. I wish 
that more applications would care as much as we do for old formats. And I 
took this as an example for some of my own stuff as well.

>  >> I am alo unsure about the conversion
>  >> routine itself (I would not expect it to loop through font sizes, but 
to
>  >> add a normal fontsize for the lyxline), but had no time so far to 
have a
>  >> deeper look, therefore I did not comment yet.
> 
>  > You are right.
> 
> About what?
> When the \lyxline has normal size there is no \size statement before it, 
so I removed this statement 
> and didn't set "\size normalfont". The loop is needed to check all 
possible fontsize commands.

I still don't have time to look into this in detail (maybe at the weekend), 
but I would have done something like

loop over all body lines
    if line contains font size change: remember
    if line starts a new paragraph: forget remembered font size
        if line contains lyxline
            if remembered font size is not normal
                change font size to normal directly before the lyxline
                change size to old size again directly after the lyxline


I believe that this is more robust: It would also catch lyxlines that are 
embedded in a paragraph (makes not much sense, but is possible to do), and 
it would not change the size of any text that may follow after the 
lyxline.
This could be made faster by searching for the lyxline and then find the 
beginnig of the corresponding paragraph (we have helper functions for 
this), but you get the idea.

As I said, I did not look at the details, so I may be talking nonsense 
here, but I hope you understand now what I mean.


Georg

Reply via email to