Sorry --- wrong patch attached! Here's the correct one (rather shorter ;) )

Dov Feldstern wrote:
Georg Baum wrote:
Stefan Schimanski wrote:

Then the question is only from which file format revision we start
with a lyx2lyx filter: from the change of the exporting behavior or
from the fix from today and the last days...

That depends on the format when the change happened. If it was during the
1.5 development cycle I would introduce a new file format now and declare
all 1.5svn versions between the original change and this new format buggy.
We did this for example with format 261.
If it was earlier you can't simply declare stable versions buggy (and people
will have corrected the wrong spaces by hand if they noticed), so it is
better to put the conversion between the old formats. Then it will at least
help people who now convert old documents.


Georg


Hi!

Georg, there never was a format change of this issue, but their *should* have been, because although the format of the lyx file was not changed, its interpretation *was* (not by us now, but back when the original change in the latex generation occurred, see below; as Stefan pointed out, all we did now was to bring the GUI up to date with the change which already occurred then in the latex generation).

The change I'm talking about occurred somewhere between 17143 and 17158 (I think it's 17144, but there are other changes in the above range which may be somewhat related, and format change 259 is somewhere in the middle there, too...).

This is the issue: until 17143 (including), "abc[FED ] ghi" was output to latex as "abc \R{DEF} ghi"; but starting with 17144, the output for the same text (no change in the .lyx file at all!) became "abc\R{ DEF} ghi". So a format change is needed which explicitly changes the .lyx file: any occurrence of "abc[FED ] ghi" should be changed to "abc [FED] ghi", in order that the same latex output be generated. (Note that there is no need for doing anything when downgrading: both forms will be interpreted identically in the old LyX versions, so we can just as easily use the new format, in this respect. It's just that there are some things which couldn't be typeset before 17144, so the explicit differentiation wasn't needed.)

I think that in order to deal with this cleanly, what we have to do is this: we create a new file format *now* (at first I was thinking we should use version 259 to tag these differences, because it was so close to when the changes were actually made; but then I realized the following: if someone has already converted from pre-259 to post-259, then if we now make this lyx2lyx change as part of 259, then that file will never get fixed; so we need to do it now, so that already-converted files will also get fixed. I'm not so worried about post-259 files where the above construct now exists on purpose, because it's very very rare for someone to really want it; in fact, I assume that even now it's just an oversight on the part of the user). This new file format doesn't have any real format changes associated with it, except that the version number gets incremented. Besides that, what the conversion does is to find occurrences of "space" which appear between LTR and RTL sections, and makes sure that they are in the language which has the same direction as the language of the paragraph.

So:

1) Does this sound right?

2) How do I do it in lyx2lyx? I looked at normalize_font_whitespace() ---

*** I now see what the problem is! What we need is *exactly* the change of format 259; but in lyx2lyx, the \\lang property wasn't included for some reason! The attached patch fixes this, and the output is now OK (i.e., with this patch, a file created from before the change (also attached), and in which the problem occurs, is output correctly and displays correctly in the GUI even now!). But anyway, for the reasons outlined above, I still think it's more correct to do this is a separate, new file format, effective as of now. I guess that means duplicating normalize_font_whitespace(), but having it now act *only* on the lang property (Georg, you may want to make sure there aren't any other forgotten properties, once we're at it...), and applying the new function as the converter to a new file format...

So Georg, does all this make sense? And if so, could you please take care of it? I guess we also need Jose's OK for this...

Thanks!
Dov


Index: lib/lyx2lyx/lyx_1_5.py
===================================================================
--- lib/lyx2lyx/lyx_1_5.py      (revision 17158)
+++ lib/lyx2lyx/lyx_1_5.py      (working copy)
@@ -1101,6 +1101,7 @@
                        "\\color": "none",
                        "\\shape": "default",
                        "\\bar": "default",
+                       "\\lang": "default",
                        "\\family": "default"}
     changes = {}
 

Reply via email to