On 05/14/2014 05:35 AM, Jürgen Spitzmüller wrote:
2014-05-13 19:22 GMT+02:00 Jürgen Spitzmüller:

    The attached fixes the thinko in the lyx2lyx method. However, I do
    not know what this method actually is supposed to convert, so I
    cannot really test if the conversion works. The respective commit
    (by Uwe) is this:
    
http://www.lyx.org/trac/changeset/b42604c7aa0551c4761605f1e9131b05522c98b5/lyxgit


A closer look reveals that the convert_TeX_brace_to_Argument method itself must be fixed. This method blindly searches for ERT insets from the beginning line without considering whether the inset is in the current paragraph. I suppose this will corrupt documents in many cases.

This:


Todo: this routine can currently handle only one mandatory argument of envi
     '''
+    end_layout = find_end_of_layout(document.body, line)
     lineERT = line
     endn = line
     loop = 1
-    while lineERT != -1 and n < nmax + 1:
-      lineERT = find_token(document.body, "\\begin_inset ERT", lineERT)
-      if environment == False and lineERT != -1:
+    while n < nmax + 1:
+ lineERT = find_token(document.body, "\\begin_inset ERT", lineERT, end_lay
+      if lineERT == -1:
+        break

will solve some of that problem. But I see what you mean about all the hard-coding. I may just try to re-write the method. But without any comments it is hard to know what is supposed to be happening.

Richard

Reply via email to