From f86f875a8ca3d7c7e008888b04a954f59899472a Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 5 Nov 2010 01:03:46 +0000 Subject: [PATCH] Fix up revert_rule routine. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36097 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 80ee16fbb4..b2fda3d7c1 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -1876,35 +1876,23 @@ def revert_rule(document): return # find end of inset j = find_token(document.body, "\\end_inset" , i) - # assure we found the end_inset of the current inset - if j > i + 6 or j == -1: + if j == -1: document.warning("Malformed LyX document: Can't find end of line inset.") return # determine the optional offset - k = find_token(document.body, 'offset', i, j) - if k != -1: - offset = document.body[k][8:-1] - else: - offset = "" + offset = get_value(document.body, 'offset', i, j).strip('"') + if offset: + offset = '[' + offset + ']' # determine the width - l = find_token(document.body, 'width', i, j) - if l != -1: - width = document.body[l][7:-1] - else: - width = "100col%" + width = get_value(document.body, 'width', i, j, "100col%").strip('"') + width = latex_length(width)[1] # determine the height - m = find_token(document.body, 'height', i, j) - if m != -1: - height = document.body[m][8:-1] - else: - height = "1pt" + height = get_value(document.body, 'height', i, j, "1pt").strip('"') + height = latex_length(height)[1] # output the \rule command - if offset: - subst = "\\rule[" + offset + "]{" + width + "}{" + height + "}" - else: - subst = "\\rule{" + width + "}{" + height + "}" + subst = "\\rule[" + offset + "]{" + width + "}{" + height + "}" document.body[i:j + 1] = put_cmd_in_ert(subst) - i += 1 + i += len(subst) - (j - i) def revert_diagram(document): -- 2.39.5