]> git.lyx.org Git - features.git/commitdiff
lyx_2_0.pyx_ add convert_includeall method
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 15 Mar 2020 08:32:02 +0000 (09:32 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:54 +0000 (15:48 +0200)
It's better to have that param explicitly in the document.

lib/lyx2lyx/lyx_2_0.py

index 480971b5319c38aad3e8ea7ca70e72eacf50293b..a70f3991e8e1c30a183589017cfabd28d8bca04f 100644 (file)
@@ -971,6 +971,20 @@ def revert_includeonly(document):
         document.header[i : j + 1] = []
 
 
+def convert_includeall(document):
+    " Add maintain_unincluded_children param "
+
+    i = 0
+    i = find_token(document.header, "\\maintain_unincluded_children", 0)
+    if i == -1:
+        i = find_token(document.header, "\\textclass", 0)
+        if i == -1:
+            document.warning("Malformed LyX document! Missing \\textclass header.")
+            return
+        document.header.insert(i, "\\maintain_unincluded_children false")
+        return
+
+
 def revert_includeall(document):
     " Remove maintain_unincluded_children param "
     del_token(document.header, '\\maintain_unincluded_children', 0)
@@ -2489,7 +2503,7 @@ convert = [[346, []],
            [373, [merge_gbrief]],
            [374, []],
            [375, []],
-           [376, []],
+           [376, [convert_includeall]],
            [377, []],
            [378, []],
            [379, [convert_math_output]],