]> git.lyx.org Git - features.git/commitdiff
Python fixes from José Matos
authorScott Kostyshak <skostysh@lyx.org>
Sun, 20 Aug 2023 01:32:41 +0000 (21:32 -0400)
committerScott Kostyshak <skostysh@lyx.org>
Sun, 20 Aug 2023 02:08:08 +0000 (22:08 -0400)
See here:

  https://www.mail-archive.com/search?l=mid&q=a7960223ee91696e916b281d1d9fc55df10a9480.camel%40gmail.com

Description from José pasted below:

  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.

lib/lyx2lyx/lyx_1_2.py
lib/lyx2lyx/lyx_2_0.py
lib/lyx2lyx/lyx_2_3.py

index ae082a73fcbe6f5530ca24613ce3192563b3e881..e091b3b1e9adcfea227ad8a0342899c0153b2311 100644 (file)
@@ -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"')
 
index 3f87e40ae331a452584a2a4b532672731ecd94a3..254f47bc09a4ae406c7c8463ed80190e783504f0 100644 (file)
@@ -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] == "":
index 69b2abac83d10d1f2d15f6e6b7411ebe194f4121..5e330ed79e12612195d2fe9903c947492f2dbb61 100644 (file)
@@ -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