SEESenv/scripts/myrst2xml.py
changeset 27 cb14131583c6
parent 2 52d12eb31c30
child 30 f66b0a5ebf40
--- a/SEESenv/scripts/myrst2xml.py	Tue Feb 23 19:56:48 2010 +0530
+++ b/SEESenv/scripts/myrst2xml.py	Thu Feb 25 00:04:27 2010 +0530
@@ -13,8 +13,9 @@
 import pkg_resources
 import time
 from docutils.core import publish_file 
+import os
 chapterno=0
-
+tmp_folder="/home/hg/repos/SEES-hacks/"
 
 
 
@@ -23,28 +24,20 @@
 
 
 
-def convert2xml(file):
-#    print folder,subfolder,file
-    file=file.split("\n")[0]
-    file= file.split("\t")[0]  
-    global chapterno
+def convert2xml(file_name):
+    """ convert to xml using rst2xml internally """
+    global chapterno    
+    file=file.split()[0]
     name=file.split('/')[-1]
     name='ch'+str(chapterno)+name.split('.')[0]
-#    full_file=os.path.join(folder,file)    
-#    if file.endswith('.rst'):    
+  
     print file	    
     xml_file=name+'.xml'        
     a=open(xml_file,'w')
-#    a.close()
-#    command="rst2xml.py %s > %s" %(file , xml_file)
-          
-#    a=subprocess.Popen(command , shell=True)
-#    time.sleep(10) 	   	
-#    a.kill()
     publish_file(source_path=file, destination_path=xml_file,parser_name='restructuredtext', writer_name='xml') 
 def walk(repo):
     global chapterno
-    mainfolder='/home/amit/sttp_latest/'    
+    mainfolder='/home/hg/repos/sttp/'    
     for readline in open('index.config','r').readlines():
         chapterno+=1		
         filename=mainfolder+readline