]> git.lyx.org Git - lyx.git/commitdiff
* lib/lyx2lyx/lyx_1_6.py:
authorJürgen Spitzmüller <spitz@lyx.org>
Sat, 10 May 2008 17:19:26 +0000 (17:19 +0000)
committerJürgen Spitzmüller <spitz@lyx.org>
Sat, 10 May 2008 17:19:26 +0000 (17:19 +0000)
- more work on InsetIndex reversion. Still lots left to do.

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

lib/lyx2lyx/lyx_1_6.py

index 3506a2ea9cebbe856a070ec839c392d7f3074ec9..e0e33ea8686ffaa3c83dcd4b20d458bfd126836c 100644 (file)
@@ -812,10 +812,12 @@ def revert_latexcommand_index(document):
         document.body[i + 1] =  "LatexCommand index"
         # clean up multiline stuff
         content = ""
+        ert_end = 0
         for k in range(i + 3, j - 2):
           line = document.body[k]
           if line.startswith("\\begin_inset ERT"):
-            line = line[16:]
+              ert_end = find_end_of_inset(document.body, k + 1)
+              line = line[16:]
           if line.startswith("\\begin_inset Formula"):
             line = line[20:]
           if line.startswith("\\begin_layout Standard"):
@@ -828,8 +830,15 @@ def revert_latexcommand_index(document):
             line = line[10:]
           if line.startswith("status collapsed"):
             line = line[16:]
-          line = line.replace(u'ä', r'\\\"a').replace(u'ö', r'\\\"o').replace(u'ü', r'\\\"u')
-          line = line.replace(r'\backslash', r'\textbackslash{}')
+          if line.startswith("status open"):
+            line = line[11:]
+          # do not replace inside ERTs
+          if ert_end < k:
+              line = line.replace(u'ä', r'\\\"a').replace(u'ö', r'\\\"o').replace(u'ü', r'\\\"u')
+              line = line.replace(r'\backslash', r'\textbackslash{}')
+              line = line.replace(r'\InsetSpace ', r'')
+          else:
+              line = line.replace(r'\backslash', r'\\')
           content = content + line;
         document.body[i + 3] = "name " + '"' + content + '"'
         for k in range(i + 4, j - 2):