From 2878afa5a79d8c6833a00c3a335ea0c69df016b3 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 5 Nov 2010 14:58:32 +0000 Subject: [PATCH] Minor fixups for revert_splitindex. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36109 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 1540323775..85bb6e6915 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -336,12 +336,11 @@ def revert_splitindex(document): if i == -1: document.warning("Malformed LyX document: Missing \\use_indices.") return - indices = get_value(document.header, "\\use_indices", i) - preamble = "" - useindices = (indices == "true") - if useindices: - preamble += "\\usepackage{splitidx}\n" + useindices = str2bool(get_value(document.header, "\\use_indices", i)) del document.header[i] + preamble = [] + if useindices: + preamble.append("\\usepackage{splitidx})") # deal with index declarations in the preamble i = 0 @@ -360,9 +359,9 @@ def revert_splitindex(document): iname = m.group(1) ishortcut = get_value(document.header, '\\shortcut', i, k) if ishortcut != "": - preamble += "\\newindex[" + iname + "]{" + ishortcut + "}\n" + preamble.append("\\newindex[" + iname + "]{" + ishortcut + "}") del document.header[i:k + 1] - if preamble != "": + if preamble: insert_to_preamble(0, document, preamble) # deal with index insets -- 2.39.2