]> git.lyx.org Git - features.git/commitdiff
lyx_1_4.py(convert_sgml_paragraphs):
authorJosé Matox <jamatos@lyx.org>
Mon, 10 Apr 2006 09:14:08 +0000 (09:14 +0000)
committerJosé Matox <jamatos@lyx.org>
Mon, 10 Apr 2006 09:14:08 +0000 (09:14 +0000)
convert SGML paragraphs to Standard + ERT, as SGML are not used anymore.

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

lib/lyx2lyx/lyx_1_4.py

index edc027cff5955fafc5eb71436ef7d6f5ece19fa6..82e8bc169e2750ecc93f79cee82649dc39d2739a 100644 (file)
@@ -2364,6 +2364,27 @@ def remove_quotestimes(file):
     del file.header[i]
 
 
+##
+# Convert SGML paragraphs
+#
+def convert_sgml_paragraphs(file):
+    if file.backend != "docbook":
+        return
+
+    i = 0
+    while 1:
+        i = find_token(file.body, "\\begin_layout SGML", i)
+
+        if i == -1:
+            return
+
+        file.body[i] = "\\begin_layout Standard"
+        j = find_token(file.body, "\\end_layout", i)
+
+        file.body[j+1:j+1] = ['','\\end_inset','','','\\end_layout']
+        file.body[i+1:i+1] = ['\\begin_inset ERT','status inlined','','\\begin_layout Standard','']
+
+        i = i + 10
 ##
 # Convertion hub
 #
@@ -2393,7 +2414,7 @@ convert = [[222, [insert_tracking_changes, add_end_header, convert_amsmath]],
            [242, [convert_french]],
            [243, [remove_paperpackage]],
           [244, [rename_spaces]],
-          [245, [remove_quotestimes]]]
+          [245, [remove_quotestimes, convert_sgml_paragraphs]]]
 
 revert =  [[244, []],
           [243, [revert_space_names]],