]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_2_2.py
Fix Python unicode string in lyx2lyx
[lyx.git] / lib / lyx2lyx / lyx_2_2.py
index 37b83e8e72998fa4735f3b073b3e9332363378aa..2f4ef3ac2a9c3a03b6958308d6603f02b82d6da7 100644 (file)
@@ -659,6 +659,12 @@ def convert_dashes(document):
 def revert_dashes(document):
     "convert \\twohyphens and \\threehyphens to -- and ---"
 
+    # eventually remove preamble code from 2.3->2.2 conversion:
+    for i, line in enumerate(document.preamble):
+        if i > 1 and line == r'\renewcommand{\textemdash}{---}':
+            if (document.preamble[i-1] == r'\renewcommand{\textendash}{--}'
+                and document.preamble[i-2] == '% Added by lyx2lyx'):
+                del document.preamble[i-2:i+1]
     i = 0
     while i < len(document.body):
         words = document.body[i].split()
@@ -1092,11 +1098,13 @@ def revert_BoxFeatures(document):
         if i == -1:
             return
         binset = find_token(document.body, "\\begin_inset Box", i - 11)
-        if binset == -1:
-            return # then "thickness" is is just a word in the text
+        if binset == -1 or binset != i - 11:
+            i = i + 1
+            continue # then "thickness" is is just a word in the text
         einset = find_end_of_inset(document.body, binset)
         if einset == -1:
             document.warning("Malformed LyX document: Can't find end of box inset!")
+            i = i + 1
             continue
         # read out the values
         beg = document.body[i].find('"');