From 4bdd6f7937bffa2be591c2f6c37c1a1130a0b090 Mon Sep 17 00:00:00 2001 From: Martin Vermeer Date: Mon, 19 Nov 2007 19:53:54 +0000 Subject: [PATCH] Correct conversion of math insets inside Index git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21680 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_1_6.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index d62ef3eb4d..ce4d31d104 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -359,12 +359,28 @@ def convert_latexcommand_index(document): return if document.body[i + 1] != "LatexCommand index": # Might also be index_print return - fullcommand = document.body[i + 2] - document.body[i] = "\\begin_inset Index" - document.body[i + 1] = "status collapsed" - document.body[i + 2] = "\\begin_layout standard" - document.body.insert(i + 3, fullcommand[6:].strip('"')) - document.body.insert(i + 4, "\\end_layout") + fullcontent = document.body[i + 2][6:].strip('"') + document.body[i:i + 2] = ["\\begin_inset Index", + "status collapsed", + "\\begin_layout standard"] + # Put here the conversions needed from LaTeX string + # to LyXText: + # Math: + r = re.compile('^(.*?)(\$.*?\$)(.*)') + g = fullcontent + while r.match(g): + m = r.match(g) + s = m.group(1) + f = m.group(2).replace('\\\\', '\\') + g = m.group(3) + if s: + document.body.insert(i + 3, s) + i += 1 + document.body.insert(i + 3, "\\begin_inset Formula " + f) + document.body.insert(i + 4, "\\end_inset") + i += 2 + document.body.insert(i + 3, g) + document.body[i + 4] = "\\end_layout" i = i + 5 -- 2.39.5