]> git.lyx.org Git - features.git/commitdiff
Minor cleanup for additional index reversion routines.
authorRichard Heck <rgheck@comcast.net>
Thu, 4 Nov 2010 01:07:42 +0000 (01:07 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 4 Nov 2010 01:07:42 +0000 (01:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36027 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_2_0.py

index 695796092fe6509a6313e373d58b12a9ae2f2334..9f7abf53c5e5bb56c2d483522db8ab60b2a3eb50 100644 (file)
@@ -785,6 +785,7 @@ def revert_subindex(document):
         document.warning("Malformed LyX document: Missing \\use_indices.")
         return
     indices = get_value(document.header, "\\use_indices", i)
+    useindices = (indices == "true")
     i = 0
     while True:
         i = find_token(document.body, "\\begin_inset CommandInset index_print", i)
@@ -793,13 +794,13 @@ def revert_subindex(document):
         k = find_end_of_inset(document.body, i)
         ctype = get_value(document.body, 'LatexCommand', i, k)
         if ctype != "printsubindex":
-            i = i + 1
+            i = k + 1
             continue
         ptype = get_value(document.body, 'type', i, k).strip('"')
-        if indices == "false":
+        if not useindices:
             del document.body[i:k + 1]
         else:
-            subst = [old_put_cmd_in_ert("\\printsubindex[" + ptype + "]{}")]
+            subst = put_cmd_in_ert("\\printsubindex[" + ptype + "]{}")
             document.body[i:k + 1] = subst
         i = i + 1
 
@@ -811,6 +812,7 @@ def revert_printindexall(document):
         document.warning("Malformed LyX document: Missing \\use_indices.")
         return
     indices = get_value(document.header, "\\use_indices", i)
+    useindices = (indices == "true")
     i = 0
     while True:
         i = find_token(document.body, "\\begin_inset CommandInset index_print", i)
@@ -819,12 +821,12 @@ def revert_printindexall(document):
         k = find_end_of_inset(document.body, i)
         ctype = get_value(document.body, 'LatexCommand', i, k)
         if ctype != "printindex*" and ctype != "printsubindex*":
-            i = i + 1
+            i = k
             continue
-        if indices == "false":
+        if not useindices:
             del document.body[i:k + 1]
         else:
-            subst = [old_put_cmd_in_ert("\\" + ctype + "{}")]
+            subst = put_cmd_in_ert("\\" + ctype + "{}")
             document.body[i:k + 1] = subst
         i = i + 1