From: Richard Heck Date: Thu, 4 Nov 2010 12:32:09 +0000 (+0000) Subject: Fix up revert_longtable_align routine. Also, fix a couple thinkos in an X-Git-Tag: 2.0.0~2076 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=bd11f5a78cd5ec5cd10f3d4c195d4249710b4c00;p=features.git Fix up revert_longtable_align routine. Also, fix a couple thinkos in an earlier tabular routine. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36039 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 1faed1612f..8e4094249e 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -445,12 +445,12 @@ def revert_tabularvalign(document): end = find_end_of_inset(document.body, i) if end == -1: document.warning("Can't find end of inset at line " + str(i)) - i = j + i += 1 continue fline = find_token(document.body, "' - i = end + i += 1 continue # no longtable @@ -501,7 +501,9 @@ def revert_tabularvalign(document): '', '\\begin_layout Plain Layout'] document.body[i:i] = subst # this just inserts the array at i - i = end + len(subst) # adjust i to save a few cycles + # since there could be a tabular inside a tabular, we cannot + # jump to end + i += len(subst) def revert_phantom_types(document, ptype, cmd): @@ -934,18 +936,30 @@ def revert_applemac(document): def revert_longtable_align(document): " Remove longtable alignment setting " i = 0 - j = 0 while True: i = find_token(document.body, "\\begin_inset Tabular", i) if i == -1: break - # the alignment is 2 lines below \\begin_inset Tabular - j = document.body[i + 2].find("longtabularalignment") + end = find_end_of_inset(document.body, i) + if end == -1: + document.warning("Can't find end of inset at line " + str(i)) + i += 1 + continue + fline = find_token(document.body, "' - i = i + 1 + i += 1 + continue + # FIXME Is this correct? It wipes out everything after the + # one we found. + document.body[fline] = document.body[fline][:j - 1] + '>' + # since there could be a tabular inside this one, we + # cannot jump to end. + i += 1 def revert_branch_filename(document):