From ddb82b74f061915613bc1743d3b89fdb5ffd82e4 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 26 Feb 2015 20:34:36 +0100 Subject: [PATCH] Make convert_dashes and revert_dashes symmetric Otherwise we could destroy math stuff. --- lib/lyx2lyx/lyx_2_2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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", "--") -- 2.39.2