]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyxconvert_227.py
add bibtopic support (bug 870).
[lyx.git] / lib / lyx2lyx / lyxconvert_227.py
index 9d7f557f24e98537e834ce08e93ec412f1c0286e..208156838477943bd3f96c3f9499d80e8db1c99e 100644 (file)
@@ -1,4 +1,5 @@
 # This file is part of lyx2lyx
+# -*- coding: iso-8859-1 -*-
 # Copyright (C) 2003 José Matos <jamatos@fep.up.pt>
 #
 # This program is free software; you can redistribute it and/or
@@ -16,7 +17,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 import sys
-from parser_tools import find_tokens
+from parser_tools import find_token, find_tokens
 
 def convert_collapsable(lines):
     i = 0
@@ -34,8 +35,8 @@ def convert_collapsable(lines):
             break
 
         # Seach for a line starting 'collapsed'
-        # If, however, we find a line starting '\layout' (_always_ present)
-        # then break with a warning message
+        # If, however, we find a line starting '\begin_layout'
+        # (_always_ present) then break with a warning message
         i = i + 1
         while 1:
             if (lines[i] == "collapsed false"):
@@ -44,7 +45,35 @@ def convert_collapsable(lines):
             elif (lines[i] == "collapsed true"):
                 lines[i] = "status collapsed"
                 break
-            elif (lines[i][:7] == "\\layout"):
+            elif (lines[i][:13] == "\\begin_layout"):
+                sys.stderr.write("Malformed lyx file\n")
+                break
+            i = i + 1
+
+        i = i + 1
+
+def convert_ert(lines):
+    i = 0
+    while 1:
+        i = find_token(lines, "\\begin_inset ERT", i)
+        if i == -1:
+            break
+
+        # Seach for a line starting 'status'
+        # If, however, we find a line starting '\begin_layout'
+        # (_always_ present) then break with a warning message
+        i = i + 1
+        while 1:
+            if (lines[i] == "status Open"):
+                lines[i] = "status open"
+                break
+            elif (lines[i] == "status Collapsed"):
+                lines[i] = "status collapsed"
+                break
+            elif (lines[i] == "status Inlined"):
+                lines[i] = "status inlined"
+                break
+            elif (lines[i][:13] == "\\begin_layout"):
                 sys.stderr.write("Malformed lyx file\n")
                 break
             i = i + 1
@@ -53,6 +82,7 @@ def convert_collapsable(lines):
 
 def convert(header, body):
     convert_collapsable(body)
+    convert_ert(body)
 
 if __name__ == "__main__":
     pass