From: Richard Heck Date: Fri, 5 Nov 2010 14:58:32 +0000 (+0000) Subject: Minor fixups for revert_splitindex. X-Git-Tag: 2.0.0~2007 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=2878afa5a79d8c6833a00c3a335ea0c69df016b3;p=features.git Minor fixups for revert_splitindex. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36109 a592a061-630c-0410-9148-cb99ea01b6c8 --- 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