]> git.lyx.org Git - lyx.git/blobdiff - lib/lyx2lyx/lyxconvert_221.py
status tag patch from Georg
[lyx.git] / lib / lyx2lyx / lyxconvert_221.py
index 510e696cdfb0e0f73bbc28eed4680c488d015796..bf4e76edcf4c4712d650af01248fc3f46416c1e0 100644 (file)
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
+import string
+from parser_tools import find_token
 
+def add_end(header):
+    header.append("\\end_header");
+
+def convert_spaces(lines):
+    for i in range(len(lines)):
+        lines[i] = string.replace(lines[i],"\\SpecialChar ~","\\InsetSpace ~")
+
+def convert_bibtex(lines):
+    for i in range(len(lines)):
+        lines[i] = string.replace(lines[i],"\\begin_inset LatexCommand \\BibTeX",
+                                  "\\begin_inset LatexCommand \\bibtex")
+
+def remove_insetparent(lines):
+    i = 0
+    while 1:
+        i = find_token(lines, "\\begin_inset LatexCommand \\lyxparent", i)
+        if i == -1:
+            break
+        del lines[i:i+3]
 
 def convert(header, body):
-    pass
+    add_end(header)
+    convert_spaces(body)
+    convert_bibtex(body)
+    remove_insetparent(body)
 
 if __name__ == "__main__":
     pass