From: Uwe Stöhr Date: Thu, 11 Feb 2010 04:10:57 +0000 (+0000) Subject: lyx_2_0.py: X-Git-Tag: 2.0.0~4076 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=34012e0bee301286dc4811826c629bca978be630;p=features.git lyx_2_0.py: - fix the "revert_tabularvalign" routine (avoid endless loop when a cell contains ERT) - add a command in routine "revert_nomencl_cwidth" - routine to revert multirow table cells git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33419 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 4b976ddb1c..c4ead5d531 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -255,9 +255,9 @@ def revert_tabularvalign(document): i = find_token(document.body, "\\begin_inset Tabular", i) if i == -1: return - j = find_end_of_inset(document.body, i) + j = find_token(document.body, "", i) if j == -1: - document.warning("Malformed LyX document: Could not find end of tabular.") + document.warning("Malformed LyX document: Could not find end of tabular cell.") i = j continue # don't set a box for longtables, only delete tabularvalignment @@ -291,7 +291,7 @@ def revert_tabularvalign(document): i = j continue subst = ['\\end_layout', '\\end_inset'] - document.body[j+1:j+1] = subst # just inserts those lines + document.body[j:j] = subst # just inserts those lines subst = ['\\begin_inset Box Frameless', 'position "' + tabularvalignment +'"', 'hor_pos "c"', @@ -772,6 +772,7 @@ def revert_nomencl_cwidth(document): continue width = get_value(document.body, "width", i, j).strip('"') del document.body[l] + add_to_preamble(document, ["% this command was inserted by lyx2lyx"]) add_to_preamble(document, ["\\setlength{\\nomlabelwidth}{" + width + "}"]) i = i + 1 @@ -1162,6 +1163,44 @@ def revert_includeall(document): del document.header[i] +def revert_multirow(document): + " Revert multirow cells in tables " + i = 0 + multirow = False + while True: + # cell type 3 is multirow begin cell + i = find_token(document.body, '