From: Uwe Stöhr Date: Sat, 11 Jul 2009 13:01:16 +0000 (+0000) Subject: lyx_2_0.py: fix revert_tabularvalign X-Git-Tag: 2.0.0~6092 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=fa7601025015f3539fa418307b12dab8bcd231fe;p=features.git lyx_2_0.py: fix revert_tabularvalign git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30476 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index f6101f9267..28786725ca 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -207,38 +207,48 @@ def revert_tabularvalign(document): document.warning("Malformed LyX document: Could not find end of tabular.") i = j continue - - k = find_token(document.body, "') - m = tabularvalignment_re.match(document.body[k]) - if not m: - i = j - continue - - tabularvalignment = m.group(1) - - subst = ['\\end_layout', '\\end_inset'] - document.body[j+1:j+1] = subst # just inserts those lines - subst = ['\\begin_inset Box Frameless', - 'position "' + tabularvalignment[0] +'"', - 'hor_pos "c"', - 'has_inner_box 1', - 'inner_pos "c"', - 'use_parbox 0', - 'width "0col%"', - 'special "none"', - 'height "1in"', - 'height_special "totalheight"', - 'status open', - '', - '\\begin_layout Plain Layout'] - document.body[i:i] = subst # this just inserts the array at i - i += len(subst) + 2 # adjust i to save a few cycles + # don't set a box for longtables, only delete tabularvalignment + p = find_token(document.body, " -1: + document.body[p] = document.body[p][:q-1] + document.body[p] = document.body[p] + '>' + i = i + 1 + + # when no longtable + if p == -1: + k = find_token(document.body, "') + m = tabularvalignment_re.match(document.body[k]) + if not m: + i = j + continue + + tabularvalignment = m.group(1) + + subst = ['\\end_layout', '\\end_inset'] + document.body[j+1:j+1] = subst # just inserts those lines + subst = ['\\begin_inset Box Frameless', + 'position "' + tabularvalignment[0] +'"', + 'hor_pos "c"', + 'has_inner_box 1', + 'inner_pos "c"', + 'use_parbox 0', + 'width "0col%"', + 'special "none"', + 'height "1in"', + 'height_special "totalheight"', + 'status open', + '', + '\\begin_layout Plain Layout'] + document.body[i:i] = subst # this just inserts the array at i + i += len(subst) + 2 # adjust i to save a few cycles def revert_phantom(document):