SEESenv/scripts/rst2docbook.py
author amit@thunder
Mon, 12 Apr 2010 15:12:41 +0530
changeset 49 3b5f1341d6c6
parent 46 7f011b42609c
permissions -rw-r--r--
Some small changes ... bug fixes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     1
#!/usr/bin/python
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     2
"""
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     3
Just a hack to convert rst to xml and then docbook . 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     4
May not containt all the required elements of a docbook .
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     5
Just done to make it run for the specific rst for our 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     6
sees documentation.
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     7
"""
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
     8
import xml.etree.ElementTree as ET
36
a542eb905ced Testing
amit@thunder
parents: 33
diff changeset
     9
#from lxml import etree as ET2
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    10
import os 
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    11
import re
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    12
import subprocess
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    13
import os
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    14
import pkg_resources
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    15
import glob, os, re, sys
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    16
from docbook import Writer
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    17
from docutils.core import publish_file 
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    18
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    19
#repo="/home/hg/repos/test_review/sttp/"
41
e54725be4df6 Changed paths dependent on repo location to be taken from the script also changed how the soup is printed
amit@thunder
parents: 36
diff changeset
    20
repo=sys.argv[1]
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    21
#names = glob.glob(os.path.join(repo , '*.rst'))
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    22
tmp_folder="/home/hg/repos/SEES-hacks/temp/"
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    23
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    24
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    25
chapterno=0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    26
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    27
# def convert2xml(file):
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    28
# #    print folder,subfolder,file
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    29
#     global chapterno
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    30
#     name=file.split('/')[-1]
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    31
#     name=str(chapterno)+name.split('.')[0]
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    32
# #    full_file=os.path.join(folder,file)    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    33
# #    if file.endswith('.rst'):    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    34
#     print file	    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    35
#     xml_file=name+'.xml'        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    36
#     command="rst2xml.py %s > %s" %(file , xml_file)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    37
#     print command        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    38
#     a=subprocess.Popen(command , shell=True)
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    39
	   	
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    40
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    41
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    42
# def walk(repo):
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    43
#     global chapterno
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    44
#     mainfolder='/home/amit/sttp_latest/'    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    45
#     for readline in open('index.config','r').readlines():
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    46
#         chapterno+=1		
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    47
#         filename=mainfolder+readline
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    48
#         convert2xml(filename)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    49
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    50
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
    51
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    52
# def convert2docbook(name ,xml_string):
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    53
#     """changing tags to convert the xml to docbook"""	
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
    54
        
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    55
#     xml_string=re.sub('<strong>','<emphasis role="strong">', xml_string)   
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    56
#     xml_string=re.sub('</strong>' ,'</emphasis>',xml_string)   
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    57
#     xml_string=re.sub('<literal_block xml:space="preserve">','<literal_block xml:space="preserve">\n',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    58
#     xml_string=re.sub('<literal_block xml:space="preserve">','<programlisting>',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    59
#     xml_string=re.sub('</literal_block>','</programlisting>',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    60
#     xml_string=re.sub('<paragraph>' ,'<para>',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    61
#     xml_string=re.sub('</paragraph>' ,'</para>',xml_string)  
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    62
    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    63
#     xml_string=re.sub('<bullet_list bullet="[-*+]">','<itemizedlist mark="*">',xml_string,)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    64
#     xml_string=re.sub('</bullet_list>','</itemizedlist>',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    65
#     xml_string=re.sub('<list_item>','<listitem>',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    66
#     xml_string=re.sub('</list_item>','</listitem>',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    67
#     xml_string=re.sub('<enumerated_list enumtype="arabic" prefix="." suffix=".">', '<orderedlist numeration="arabic">',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    68
#     xml_string=re.sub('<enumerated_list enumtype="arabic" prefix="" suffix=".">',  '<orderedlist numeration="arabic">',xml_string)  
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    69
#     xml_string=re.sub('</enumerated_list>', '</orderedlist>',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    70
#     xml_string=re.sub('<line_block>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    71
#     xml_string=re.sub('</line_block>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    72
#     xml_string=re.sub('<line>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    73
#     xml_string=re.sub('</line>', '',xml_string)   
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    74
#     xml_string=re.sub('<block_quote>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    75
#     xml_string=re.sub('</block_quote>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    76
#     xml_string=re.sub('<title_reference>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    77
#     xml_string=re.sub('</title_reference>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    78
#     xml_string=re.sub('<definition>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    79
#     xml_string=re.sub('</definition>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    80
#     xml_string=re.sub('<definition_list_item>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    81
#     xml_string=re.sub('</definition_list_item>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    82
#     xml_string=re.sub('<definition_list>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    83
#     xml_string=re.sub('</definition_list>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    84
#     xml_string=re.sub('<term>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    85
#     xml_string=re.sub('</term>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    86
#     xml_string=re.sub('<entry>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    87
#     xml_string=re.sub('</entry>', '',xml_string) 	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    88
#     xml_string=re.sub('<row>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    89
#     xml_string=re.sub('</row>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    90
#     xml_string=re.sub('<tbody>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    91
#     xml_string=re.sub('</tbody>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    92
#     xml_string=re.sub('<table>', '',xml_string)			
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    93
#     xml_string=re.sub('</table>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    94
#     xml_string=re.sub('<thead>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    95
#     xml_string=re.sub('</thead>', '',xml_string)	
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
    96
    
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    97
#     xml_string=re.sub('<tgroup.*"/>', '',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    98
#     xml_string=re.sub('</tgroup>', '',xml_string)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
    99
#     chapter= ET.Element("chapter")
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   100
#     article=ET.SubElement(chapter,"article")
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   101
#     articleinfo=ET.SubElement(article,"articleinfo")
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   102
		
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   103
#     try:	
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   104
    
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   105
# #        print name    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   106
#         tree = ET.fromstring(xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   107
#     except:
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   108
#         pass        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   109
#         #print name        
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   110
               
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   111
#       #  tree=ET2.fromstring(xml_string)    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   112
#         #print "xml_string problem"	
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   113
        
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   114
#     #   print "fromstring"	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   115
#     try:    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   116
#         title= ET.SubElement(articleinfo,"title") 
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   117
#         title_element=tree.find('title')
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   118
#         title.text=title_element.text
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   119
#         article.insert(1,tree)	
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   120
#     except:
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   121
#         if name not in ('ch12index.xml',):        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   122
#             title= ET.SubElement(articleinfo,"title") 
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   123
#             section_element=tree.find('section')
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   124
#             title_element=section_element.find('title')
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   125
#             title.text=title_element.text
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   126
#             article.insert(1,tree)                
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   127
            
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   128
#     xml_string=ET.tostring(chapter)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   129
#     xml_string=xml_string.replace('\\',' ')    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   130
#     xml_string=re.sub('<document[-A-Za-z=/_" .0-9:]*>' ,'',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   131
#     xml_string=re.sub('</document>' ,'',xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   132
# #    xml_string=re.sub('</section></section></section>' ,'</section></section>',xml_string)    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   133
#     return xml_string
4
231572ecfb59 Some more tags added
amit@thunder
parents: 2
diff changeset
   134
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   135
def convert2docbook(file_name):
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   136
    global chapterno    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   137
    file_name=file_name.split()[0]
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   138
    name=file_name.split('/')[-1]
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   139
   
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   140
    xml_file_temp='/'.join(file_name.split('/')[:-2])
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   141
     
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   142
    name='ch'+str(chapterno)+name.split('.')[0]
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   143
    docbook_file=tmp_folder+name+'.docbook'
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   144
    print docbook_file   
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   145
    writer=Writer()
49
3b5f1341d6c6 Some small changes ... bug fixes
amit@thunder
parents: 46
diff changeset
   146
    try:    
3b5f1341d6c6 Some small changes ... bug fixes
amit@thunder
parents: 46
diff changeset
   147
    	publish_file(source_path=file_name, destination_path=docbook_file,parser_name='restructuredtext', writer=writer) 
3b5f1341d6c6 Some small changes ... bug fixes
amit@thunder
parents: 46
diff changeset
   148
    except :
3b5f1341d6c6 Some small changes ... bug fixes
amit@thunder
parents: 46
diff changeset
   149
        pass    
4
231572ecfb59 Some more tags added
amit@thunder
parents: 2
diff changeset
   150
    
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   151
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   152
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   153
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   154
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   155
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   156
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   157
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   158
        
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   159
    # for name in names:
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   160
           
46
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   161
    # #print name        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   162
    # #xml_string=open(name,'r').read()
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   163
    #     xml_string=open(name,'r').read()
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   164
    #     xml_string=convert2docbook(name,xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   165
    #     docbook_file=name.split('.')[0]+'.docbook'
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   166
    #     f=open(docbook_file,'w')
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   167
    #     try:        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   168
    #             f.write(xml_string)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   169
    #     except:
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   170
    #             pass
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   171
def main():
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   172
    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   173
    global chapterno
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   174
#    mainfolder='/home/hg/repos/sttp/'    
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   175
    for readline in open('/home/hg/repos/SEES-hacks/index.config','r').readlines():
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   176
        chapterno+=1		
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   177
        filename=repo+readline
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   178
        print filename        
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   179
        convert2docbook(filename)
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   180
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   181
if __name__=='__main__':
7f011b42609c Using Docutils for the conversion instead of regex
amit@thunder
parents: 41
diff changeset
   182
    main()
0
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   183
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   184
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   185
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   186
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   187
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   188
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   189
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   190
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   191
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   192
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   193
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   194
8083d21c0020 The first commit of all the required files for the review app
amit@thunder
parents:
diff changeset
   195
26
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   196
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   197
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   198
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   199
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   200
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   201
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   202
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   203
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   204
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   205
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   206
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   207
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   208
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   209
1846ab4ebdda Bug fixes and added a script for changes in final html
amit@thunder
parents: 6
diff changeset
   210