]> git.lyx.org Git - features.git/blobdiff - lib/lyx2lyx/lyx_2_0.py
ctests: uninvert two xhtml tests
[features.git] / lib / lyx2lyx / lyx_2_0.py
index 480971b5319c38aad3e8ea7ca70e72eacf50293b..c302f8ebaccab9e5147c85f6cbc822c028d2fdfa 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)
@@ -1105,7 +1119,7 @@ def revert_multirow(document):
 
 
 def convert_math_output(document):
-    " Convert \html_use_mathml to \html_math_output "
+    r" Convert \html_use_mathml to \html_math_output "
     i = find_token(document.header, "\\html_use_mathml", 0)
     if i == -1:
         return
@@ -1122,7 +1136,7 @@ def convert_math_output(document):
 
 
 def revert_math_output(document):
-    " Revert \html_math_output to \html_use_mathml "
+    r" Revert \html_math_output to \html_use_mathml "
     i = find_token(document.header, "\\html_math_output", 0)
     if i == -1:
         return
@@ -1605,8 +1619,8 @@ def revert_IEEEtran(document):
 
 def convert_prettyref(document):
        " Converts prettyref references to neutral formatted refs "
-       re_ref = re.compile("^\s*reference\s+\"(\w+):(\S+)\"")
-       nm_ref = re.compile("^\s*name\s+\"(\w+):(\S+)\"")
+       re_ref = re.compile("^\\s*reference\\s+\"(\\w+):(\\S+)\"")
+       nm_ref = re.compile("^\\s*name\\s+\"(\\w+):(\\S+)\"")
 
        i = 0
        while True:
@@ -1627,8 +1641,8 @@ def convert_prettyref(document):
 
 def revert_refstyle(document):
        " Reverts neutral formatted refs to prettyref "
-       re_ref = re.compile("^reference\s+\"(\w+):(\S+)\"")
-       nm_ref = re.compile("^\s*name\s+\"(\w+):(\S+)\"")
+       re_ref = re.compile("^reference\\s+\"(\\w+):(\\S+)\"")
+       nm_ref = re.compile("^\\s*name\\s+\"(\\w+):(\\S+)\"")
 
        i = 0
        while True:
@@ -1709,7 +1723,7 @@ def remove_Nameref(document):
 
 
 def revert_mathrsfs(document):
-    " Load mathrsfs if \mathrsfs us use in the document "
+    r" Load mathrsfs if \mathrsfs us use in the document "
     i = 0
     for line in document.body:
       if line.find("\\mathscr{") != -1:
@@ -2065,7 +2079,7 @@ def convert_passthru(document):
     if not check_passthru:
       return
 
-    rx = re.compile("\\\\begin_layout \s*(\w+)")
+    rx = re.compile("\\\\begin_layout \\s*(\\w+)")
     beg = 0
     for lay in ["Chunk", "Scrap"]:
       while True:
@@ -2129,7 +2143,7 @@ def revert_passthru(document):
     " http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg161298.html "
     if not check_passthru:
       return
-    rx = re.compile("\\\\begin_layout \s*(\w+)")
+    rx = re.compile("\\\\begin_layout \\s*(\\w+)")
     beg = 0
     for lay in ["Chunk", "Scrap"]:
       while True:
@@ -2421,7 +2435,7 @@ def revert_langpack(document):
 
 def convert_langpack(document):
     " Add \\language_package parameter "
-    i = find_token(document.header, "\language" , 0)
+    i = find_token(document.header, r"\language" , 0)
     if i == -1:
         document.warning("Malformed document. No \\language defined!")
         return
@@ -2489,7 +2503,7 @@ convert = [[346, []],
            [373, [merge_gbrief]],
            [374, []],
            [375, []],
-           [376, []],
+           [376, [convert_includeall]],
            [377, []],
            [378, []],
            [379, [convert_math_output]],