From: Georg Baum Date: Thu, 26 Feb 2015 19:34:36 +0000 (+0100) Subject: Make convert_dashes and revert_dashes symmetric X-Git-Tag: 2.2.0alpha1~1262 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ddb82b74f061915613bc1743d3b89fdb5ffd82e4;p=lyx.git Make convert_dashes and revert_dashes symmetric Otherwise we could destroy math stuff. --- diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index b890b0bec1..1036ae902e 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -528,6 +528,17 @@ def revert_dashes(document): i = 0 while i < len(document.body): + words = document.body[i].split() + if len(words) > 1 and words[0] == "\\begin_inset" and \ + words[1] in ["ERT", "Formula", "IPA"]: + # see convert_dashes + j = find_end_of_inset(document.body, i) + if j == -1: + document.warning("Malformed LyX document: Can't find end of " + words[1] + " inset at line " + str(i)) + i += 1 + else: + i = j + continue replaced = False if document.body[i].find("\\twohyphens") >= 0: document.body[i] = document.body[i].replace("\\twohyphens", "--")