]> git.lyx.org Git - features.git/commitdiff
Fix wrong CommandInset lyx2lyx conversion
authorGeorg Baum <baum@lyx.org>
Sun, 1 Mar 2015 09:52:13 +0000 (10:52 +0100)
committerGeorg Baum <baum@lyx.org>
Sun, 1 Mar 2015 09:52:13 +0000 (10:52 +0100)
Thanks to Scott for testing. Command insets do not use InsetText for the
arguments, so users have to write them in LaTeX syntax (this is bug #4595).
Therefore we must leave hyphens alone in these insets.

lib/lyx2lyx/lyx_2_2.py

index 1036ae902e72ae11a71eccce65499dd63ad7b3a2..3cdd76d9e73cbccbae370909fa1138940088e596 100644 (file)
@@ -491,8 +491,9 @@ def convert_dashes(document):
     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"]:
-            # must not replace anything in math
+           words[1] in ["CommandInset", "ERT", "Formula", "IPA"]:
+            # must not replace anything in insets that store LaTeX contents in .lyx files
+           # (math and command insets withut overridden read() and write() methods
             # filtering out IPA makes Text::readParToken() more simple
             # skip ERT as well since it is not needed there
             j = find_end_of_inset(document.body, i)
@@ -530,7 +531,7 @@ def revert_dashes(document):
     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"]:
+           words[1] in ["CommandInset", "ERT", "Formula", "IPA"]:
             # see convert_dashes
             j = find_end_of_inset(document.body, i)
             if j == -1: