Some small changes ... bug fixes
authoramit@thunder
Mon, 12 Apr 2010 15:12:41 +0530
changeset 49 3b5f1341d6c6
parent 48 c9990f63505d
child 50 7d7df551459b
Some small changes ... bug fixes
SEESenv/scripts/docbook2html.py
SEESenv/scripts/finalhtml.py
SEESenv/scripts/rst2docbook.py
--- a/SEESenv/scripts/docbook2html.py	Mon Apr 12 04:08:23 2010 +0530
+++ b/SEESenv/scripts/docbook2html.py	Mon Apr 12 15:12:41 2010 +0530
@@ -13,4 +13,4 @@
 
     print command	
     subprocess.Popen(command,shell=True)
-    time.sleep(10)
+    time.sleep(2)
--- a/SEESenv/scripts/finalhtml.py	Mon Apr 12 04:08:23 2010 +0530
+++ b/SEESenv/scripts/finalhtml.py	Mon Apr 12 15:12:41 2010 +0530
@@ -30,12 +30,18 @@
 def finalchanges(file_name,html_string):
     """some of the final changes that need to do be done on the html before creating the final usable page in the hgbook project"""	    
 #    print html_string    
+
+
+    #handling the adding of all the javascript stuff
     replace_string="""<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>Chapter 2. Basic Python</title><link rel="stylesheet" href="/review/support/styles.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.3"><link rel="shortcut icon" type="image/png" href="/review/support/figs/favicon.png"><script type="text/javascript" src="/review/support/jquery-min.js"></script><script type="text/javascript" src="/review/support/form.js"></script><script type="text/javascript" src="/review/support/hsbook.js"></script></head>"""
     ch_name=os.path.split(file_name)[1].split('.')[0]
     chapter_names_unsorted=glob.glob(os.path.join(repo,'ch*.html'))
     chapter_names_unsorted.sort()    
     chapter_names_sorted=chapter_names_unsorted
 #    print chapter_names_sorted
+    
+
+    #handling adding the previous and the next chapter
     chapter_names_sorted=sort_doubledigit(chapter_names_sorted)
     chapter_names=chapter_names_sorted
     previous_string='<<<'
@@ -66,9 +72,10 @@
         next_chapter=''
     
     
+    #handling adding a title
+
     chapter_xml=ch_name_tmp+'.xml'
-       
-
+    
     try:    
         xml_file =open(chapter_xml,'r').read()
         xml_tree=ET.fromstring(xml_file)
@@ -96,7 +103,7 @@
         
         
 
-
+    
     
     reg_obj=re.compile('<head>.*</head>',re.DOTALL)    
     html_string=reg_obj.sub(replace_string, html_string,re.DOTALL)
@@ -110,21 +117,43 @@
         div['id'] = ch_name
     except TypeError:
         print file_name  
+    add_footer_string="""<div class="footer">
+&copy; Copyright 2009, Prabhu Ramachandran, Asokan Pichai, Shantanu Choudhary, Puneeth Chaganti, Santosh G. Vattam, Kadambari Devararajan, Madhusudan.C.S.</div>"""
+
+    position=len(soup.findall('div'))
     
+   
+
+
     soup.html.body.insert(0,NavigableString(body_add_string))
 
 
+    soup.html.body.insert(position+1,NavigableString(add_footer_string)
+    # handling adding footer
+    
     return soup
 
 if __name__=='__main__':
-	file_names=glob.glob(os.path.join(repo,'ch*.html'))
+	file_names=glob.glob(os.path.join(repo,'ch4strings_dicts.html'))
 	for file_name in file_names:
             file_obj=open(file_name,'r')
             soup=finalchanges(file_name,file_obj.read())
       	    time.sleep(1)
 	    file_obj=open(file_name,'w')
 	    print >>file_obj ,soup
-            print file_name
-
+            
+            # add_footer_string="""<div class="footer">
+# &copy; Copyright 2009, Prabhu Ramachandran, Asokan Pichai, Shantanu Choudhary, Puneeth Chaganti, Santosh G. Vattam, Kadambari Devararajan, Madhusudan.C.S.</div></body>"""
+            
+#             print file_name
+#             file_obj_footer_read=open(file_name,'r')
+#             html_string=file_obj_footer_read.read()
+#             #time.sleep(1)
+#             #print html_string
+#             print len(html_string)
+#             print re.findall("</div>",html_string)
+#             html_string=re.sub('</body>','abshdaskbd',html_string)
+#             file_obj_footer_write=open(file_name,'w')
+#             file_obj_footer_write.write(html_string)
 
 	
--- a/SEESenv/scripts/rst2docbook.py	Mon Apr 12 04:08:23 2010 +0530
+++ b/SEESenv/scripts/rst2docbook.py	Mon Apr 12 15:12:41 2010 +0530
@@ -143,10 +143,10 @@
     docbook_file=tmp_folder+name+'.docbook'
     print docbook_file   
     writer=Writer()
-#    try:    
-    publish_file(source_path=file_name, destination_path=docbook_file,parser_name='restructuredtext', writer=writer) 
-#    except :
-#        pass    
+    try:    
+    	publish_file(source_path=file_name, destination_path=docbook_file,parser_name='restructuredtext', writer=writer) 
+    except :
+        pass