]> git.lyx.org Git - features.git/commitdiff
* lyx_1_6.py:
authorJürgen Spitzmüller <spitz@lyx.org>
Tue, 2 Dec 2008 07:40:23 +0000 (07:40 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Tue, 2 Dec 2008 07:40:23 +0000 (07:40 +0000)
- fix the conversion of some more complex index insets.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27759 a592a061-630c-0410-9148-cb99ea01b6c8

lib/lyx2lyx/lyx_1_6.py

index 9be03f87be8227e40272911a5dd9f1bfdfe7b0a4..0f59bbab2f142ba0f227e1d22fe2789e2412c38f 100644 (file)
@@ -50,6 +50,8 @@ def wrap_into_ert(string, src, dst):
       + dst + '\n\\end_layout\n\\end_inset\n')
 
 def put_cmd_in_ert(string):
+    for rep in unicode_reps:
+        string = string.replace(rep[1], rep[0].replace('\\\\', '\\'))
     string = string.replace('\\', "\\backslash\n")
     string = "\\begin_inset ERT\nstatus collapsed\n\\begin_layout Standard\n" \
       + string + "\n\\end_layout\n\\end_inset"
@@ -135,7 +137,7 @@ def read_unicodesymbols():
     # Two backslashes, followed by some non-word character, and then a character
     # in brackets. The idea is to check for constructs like: \"{u}, which is how
     # they are written in the unicodesymbols file; but they can also be written
-    # as: \"u.
+    # as: \"u or even \" u.
     r = re.compile(r'\\\\(\W)\{(\w)\}')
     for line in fp.readlines():
         if line[0] != '#' and line.strip() != "":
@@ -156,8 +158,11 @@ def read_unicodesymbols():
                 # since it is done that way in the LyX file.
                 if m.group(1) == "\"":
                     command += "\\"
+                commandbl = command
                 command += m.group(1) + m.group(2)
+                commandbl += m.group(1) + ' ' + m.group(2)
                 spec_chars.append([command, unichr(eval(ucs4))])
+                spec_chars.append([commandbl, unichr(eval(ucs4))])
     fp.close()
     return spec_chars
 
@@ -238,6 +243,9 @@ def latex2ert(line):
         retval += "\n" + cmd + "\n"
         line = end
         m = labelre.match(line)
+    # put all remaining braces in ERT
+    line = wrap_into_ert(line, '}', '}')
+    line = wrap_into_ert(line, '{', '{')
     retval += line
     return retval
 
@@ -280,8 +288,11 @@ def latex2lyx(data):
         else:
             data = data.replace(rep[0], rep[1])
 
-    # Generic, \" -> ":
+    # Generic
+    # \" -> ":
     data = wrap_into_ert(data, r'\"', '"')
+    # \\ -> \:
+    data = data.replace('\\\\', '\\')
 
     # Math:
     mathre = re.compile('^(.*?)(\$.*?\$)(.*)')