]> git.lyx.org Git - features.git/commitdiff
Make convert_dashes and revert_dashes symmetric
authorGeorg Baum <baum@lyx.org>
Thu, 26 Feb 2015 19:34:36 +0000 (20:34 +0100)
committerGeorg Baum <baum@lyx.org>
Thu, 26 Feb 2015 19:34:36 +0000 (20:34 +0100)
Otherwise we could destroy math stuff.

lib/lyx2lyx/lyx_2_2.py

index b890b0bec1797fe2070ae473226f7c3b1535a75d..1036ae902e72ae11a71eccce65499dd63ad7b3a2 100644 (file)
@@ -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", "--")