From: Richard Heck Date: Thu, 4 Nov 2010 01:07:42 +0000 (+0000) Subject: Minor cleanup for additional index reversion routines. X-Git-Tag: 2.0.0~2085 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b98dcee86035a6a12b72d25866f7ce82edc7e872;p=features.git Minor cleanup for additional index reversion routines. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36027 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 695796092f..9f7abf53c5 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -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