SEESenv/scripts/finalhtml.py
changeset 41 e54725be4df6
parent 40 ef147a79b098
child 44 d0e9b52bda73
equal deleted inserted replaced
40:ef147a79b098 41:e54725be4df6
     2 #import lxml
     2 #import lxml
     3 import re
     3 import re
     4 import os
     4 import os
     5 from BeautifulSoup import BeautifulSoup
     5 from BeautifulSoup import BeautifulSoup
     6 import time
     6 import time
     7 temp_dir='/home/hg/repos/SEES-hacks/temp/'
     7 import sys
       
     8 repo='/home/hg/repos/SEES-hacks/temp/'
     8 
     9 
     9 
    10 
    10 def finalchanges(file_name,html_string):
    11 def finalchanges(file_name,html_string):
    11     """some of the final changes that need to do be done on the html before creating the final usable page in the hgbook project"""	    
    12     """some of the final changes that need to do be done on the html before creating the final usable page in the hgbook project"""	    
    12 #    print html_string    
    13 #    print html_string    
    28     except TypeError:
    29     except TypeError:
    29         print file_name  
    30         print file_name  
    30     return soup
    31     return soup
    31 
    32 
    32 if __name__=='__main__':
    33 if __name__=='__main__':
    33 	file_names=glob.glob(temp_dir+'ch*.html')
    34 	file_names=glob.glob(os.path.join(repo,'ch*.html'))
    34 	for file_name in file_names:
    35 	for file_name in file_names:
    35             file_obj=open(file_name,'r')
    36             file_obj=open(file_name,'r')
    36             soup=finalchanges(file_name,file_obj.read())
    37             soup=finalchanges(file_name,file_obj.read())
    37       	    time.sleep(1)
    38       	    time.sleep(1)
    38 	    file_obj=open(file_name,'w')
    39 	    file_obj=open(file_name,'w')