Hi,  
I noticed "en passant" (French) that there are some small glitches in the `lyx2lyx directory:

In `lyx2lyx/lyx2lyx_tools.py`:

Functions `length_in_bp` and `revert_flex_inset` have an error in a (almost) never used path. The reason why this was never triggered is because this is part of the code where we try all the best efforts to recover from an ill-formed LyX file.

The problem is that the functions call the `document` variable to issue an warning if the file does not follow the usual structure. The simple fix is to add that variable (as the first for the functions) and to add them at all the places where the functions are called.

For reference this code was introduced by Georg (Baum) more than 8 years ago and it was never reported. So the issue is not urgent in any meaningful way. :-)

In `lyx2lyx/lyx_2_0.py`, in the function `revert_nameref`, there is a call to the document variable. The same as all the above.

In `lyx2lyx/lyx_2_4.py`, in the `class fontmapping`. Similar to the above but now for error.

At the same file in the function `revert_timeinfo` in the line 1427 there is a variable being called `dte`, looking to the inverse function I suspect that `dte`  us supposed to be `date.today()` (or similar). @Jürgen could you please see this issue since this seems to be your code from 2018? :-)

I took the change to fix other bugs that are more immediate. The patch follows attached. In particular the part from the code from lyx_1_2.py was committed by me in December of 2004. :-o


I will be unavailable until almost the end of August and thus I wanted to raise this. When I return I can look into this, following the recipe given above. Again I want to stress that this is mostly for correctness sake since in practice the code will not be even run for any well formed LyX file.

Best regards,
```
-- 
José Abílio

```

diff --git a/lib/lyx2lyx/lyx_1_2.py b/lib/lyx2lyx/lyx_1_2.py
index ae082a73fc..e091b3b1e9 100644
--- a/lib/lyx2lyx/lyx_1_2.py
+++ b/lib/lyx2lyx/lyx_1_2.py
@@ -745,8 +745,8 @@ def update_longtables(document):
         for j in range(rows):
             i = find_token(body, '<row', i)
 
-            self.endfoot = false                # footer row
-            self.endlastfoot = false        # last footer row
+            row_info[i].endfoot = false            # footer row
+            row_info[i].endlastfoot = false        # last footer row
             if row_info[j].endhead:
                 insert_attribute(body, i, 'endhead="true"')
 
diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py
index 3f87e40ae3..254f47bc09 100644
--- a/lib/lyx2lyx/lyx_2_0.py
+++ b/lib/lyx2lyx/lyx_2_0.py
@@ -378,7 +378,7 @@ def revert_splitindex(document):
         l = re.compile(r'\\begin_inset Index (.*)$')
         m = l.match(line)
         itype = m.group(1)
-        if itype == "idx" or indices == "false":
+        if itype == "idx" or useindices == "false":
             document.body[i] = "\\begin_inset Index"
         else:
             k = find_end_of_inset(document.body, i)
@@ -2189,7 +2189,7 @@ def convert_passthru(document):
             break
           ne = find_end_of_inset(document.body, ns)
           if ne == -1 or ne > end:
-            document.warning("Can't find end of inset at line " + str(nb))
+            document.warning("Can't find end of inset at line " + str(ne))
             ns += 1
             continue
           if document.body[ne + 1] == "":
diff --git a/lib/lyx2lyx/lyx_2_3.py b/lib/lyx2lyx/lyx_2_3.py
index 69b2abac83..5e330ed79e 100644
--- a/lib/lyx2lyx/lyx_2_3.py
+++ b/lib/lyx2lyx/lyx_2_3.py
@@ -1427,7 +1427,7 @@ def revert_multibib(document):
         }
 
     if multibib not in units.keys():
-        document.warning("Unknown multibib value `%s'!" % nultibib)
+        document.warning("Unknown multibib value `%s'!" % multibib)
         return
     unit = units[multibib]
     btunit = False
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to