From: Richard Heck Date: Tue, 6 Jul 2010 14:50:59 +0000 (+0000) Subject: Don't rely upon there being a certain number of argumnets to the box inset. X-Git-Tag: 2.0.0~3045 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=1a3629d72090b2cd37a0aed23a8d6da137255d1a;p=features.git Don't rely upon there being a certain number of argumnets to the box inset. Some later LyX version might omit defaults without lyx2lyx to replace them. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34787 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 2a26029db4..cc0444efcb 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1830,9 +1830,13 @@ def revert_makebox(document): return j = find_token(document.body, 'use_makebox 1', i) # assure we found the makebox of the current box - if j > i + 7 or j == -1: + if j > z or j == -1: return - # remove the \end_inset + y = find_token(document.body, "\\begin_layout", i) + if y > z or y == -1: + document.warning("Malformed LyX document: Can't find layout in box.") + return + # remove the \end_layout \end_inset pair document.body[z - 2:z + 1] = put_cmd_in_ert("}") # determine the alignment k = find_token(document.body, 'hor_pos', j - 4) @@ -1846,7 +1850,7 @@ def revert_makebox(document): length = latex_length(length).split(",")[1] subst = "\\makebox[" + length + "][" \ + align + "]{" - document.body[i:i + 14] = put_cmd_in_ert(subst) + document.body[i:y+1] = put_cmd_in_ert(subst) i += 1