]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyx_1_6.py
** fix bug 2114. Fileformat change.
[lyx.git] / lib / lyx2lyx / lyx_1_6.py
index d87d84d18f639f8fe2a3660629f94590d392d26b..3b98896ac628c12d7b6c545b392a95a0400810da 100644 (file)
@@ -1071,10 +1071,11 @@ def convert_latexcommand_index(document):
         m = r1.match(document.body[i + 2])
         if m == None:
             document.warning("Unable to match: " + document.body[i+2])
-            i += 1
-            continue
-        fullcontent = m.group(1)
-        linelist = latex2lyx(fullcontent)
+            # this can happen with empty index insets!
+            linelist = [""]
+        else:
+            fullcontent = m.group(1)
+            linelist = latex2lyx(fullcontent)
         #document.warning(fullcontent)
 
         linelist = ["\\begin_inset Index", "status collapsed", "\\begin_layout Standard", ""] + \
@@ -2954,6 +2955,22 @@ def revert_mongolian(document):
         j = j + 1
 
 
+def revert_default_options(document):
+    ' Remove param use_default_options '
+    i = find_token(document.header, "\\use_default_options", 0)
+    if i != -1:
+        del document.header[i]
+
+
+def convert_default_options(document):
+    ' Add param use_default_options and set it to false '
+    i = find_token(document.header, "\\textclass", 0)
+    if i == -1:
+        document.warning("Malformed LyX document: Missing `\\textclass'.")
+        return
+    document.header.insert(i, '\\use_default_options false')
+
+
 ##
 # Conversion hub
 #
@@ -3024,10 +3041,12 @@ convert = [[277, [fix_wrong_tables]],
            [339, []],
            [340, [add_plain_layout]],
            [341, []],
-           [342, []]
+           [342, []],
+           [343, [convert_default_options]]
           ]
 
-revert =  [[341, [revert_mongolian]],
+revert =  [[342, [revert_default_options]],
+           [341, [revert_mongolian]],
            [340, [revert_tabulators, revert_tabsize]],
            [339, []],
            [338, [revert_removed_modules]],