[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Make convert_dashes and revert_dashes symmetric
From:       Georg Baum <baum () lyx ! org>
Date:       2015-02-26 19:35:15
Message-ID: 20150226193515.29CF6280800 () lyx ! lyx ! org
[Download RAW message or body]

commit ddb82b74f061915613bc1743d3b89fdb5ffd82e4
Author: Georg Baum <baum@lyx.org>
Date:   Thu Feb 26 20:34:36 2015 +0100

    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 b890b0b..1036ae9 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", "--")


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic