From 6033b020f317bb99a60bd433d3e06e77dce9eece Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 7 Jul 2008 18:50:50 +0000 Subject: [PATCH] Cosmetics, mostly. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25490 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_1_6.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 1fd46250ac..b35d3bb0e2 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -795,15 +795,20 @@ replacements = [ def convert_latexcommand_index(document): "Convert from LatexCommand form to collapsable form." i = 0 + r1 = re.compile('name "(.*)"') + r2 = re.compile('^(.*?)(\$.*?\$)(.*)') while True: i = find_token(document.body, "\\begin_inset CommandInset index", i) if i == -1: return if document.body[i + 1] != "LatexCommand index": # Might also be index_print return - fullcontent = document.body[i + 2][5:] - fullcontent.strip() - fullcontent = fullcontent[1:-1] + m = r1.match(document.body[i + 2]) + if m == None: + document.warning("Unable to match: " + document.body[i+2]) + i += 1 + continue + fullcontent = m.group(1) document.body[i:i + 3] = ["\\begin_inset Index", "status collapsed", "\\begin_layout Standard"] @@ -817,15 +822,14 @@ def convert_latexcommand_index(document): # Generic, \" -> ": fullcontent = wrap_into_ert(fullcontent, r'\"', '"') # Math: - r = re.compile('^(.*?)(\$.*?\$)(.*)') lines = fullcontent.split('\n') for line in lines: #document.warning("LINE: " + line) #document.warning(str(i) + ":" + document.body[i]) #document.warning("LAST: " + document.body[-1]) g = line - while r.match(g): - m = r.match(g) + while r2.match(g): + m = r2.match(g) s = m.group(1) f = m.group(2).replace('\\\\', '\\') g = m.group(3) @@ -1197,7 +1201,7 @@ def revert_include(document): i = 0 r0 = re.compile('preview.*') r1 = re.compile('LatexCommand (.+)') - r2 = re.compile('filename (.+)') + r2 = re.compile('filename "(.+)"') r3 = re.compile('lstparams "(.*)"') while True: i = find_token(document.body, "\\begin_inset CommandInset include", i) -- 2.39.5