From: Richard Heck Date: Mon, 7 Jul 2008 18:21:53 +0000 (+0000) Subject: Fix up convert_subfig a bit. X-Git-Tag: 1.6.10~4189 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bc6c3d91ae21b18a769a66a74317ef6485b4d1c4;p=features.git Fix up convert_subfig a bit. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25487 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 6e39e60cf8..cf55b7a4f9 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -1864,28 +1864,28 @@ def convert_subfig(document): continue k = find_token(document.body, '\tsubcaption', i, endInset) if k == -1: - i += 1 + i = endInset continue l = find_token(document.body, '\tsubcaptionText', i, endInset) + if l == -1: + document.warning("Malformed lyx document: Can't find subcaptionText!") + i = endInset + continue caption = document.body[l][16:].strip('"') - savestr = document.body[i] - laststr = document.body[endInset] del document.body[l] del document.body[k] addedLines = -2 - # savestr should no longer be needed here. subst = ['\\begin_inset Float figure', 'wide false', 'sideways false', 'status open', '', '\\begin_layout Plain Layout', '\\begin_inset Caption', '', '\\begin_layout Plain Layout', caption, '\\end_layout', '', '\\end_inset', '', - '\\end_layout', '', '\\begin_layout Plain Layout', savestr] - document.body[i : i+1] = subst - addedLines += len(subst) - 1 + '\\end_layout', '', '\\begin_layout Plain Layout'] + document.body[i : i] = subst + addedLines += len(subst) endInset += addedLines - # There should be an easier way to do this. - subst = ['', '\\end_inset', '', '\\end_layout', laststr] - document.body[endInset : endInset+1] = subst - addedLines += len(subst) - 1 + subst = ['', '\\end_inset', '', '\\end_layout'] + document.body[endInset : endInset] = subst + addedLines += len(subst) i += addedLines + 1