def __init__(self, pyppath): self.pyp_path = pyppath self.main_dir, self.pyp_name = os.path.split(self.pyp_path) self.pyp_list = txt_mixin.txt_list(pytexutils.readfile(pyppath)) self.rst_list = copy.copy(self.pyp_list) path_no_ext, ext = os.path.splitext(pyppath) self.rst_path = path_no_ext+'.rst' self.html_path = path_no_ext+'.html' self.name, junk = os.path.splitext(self.pyp_name) self.rst_name = self.name+'.rst' self.html_name = self.name+'.html'
def add_header(self, headername='header.tex',\ headerinserts=[]): header = [] if self.dir: search_dir = self.dir else: search_dir = os.getcwd() headerpath = os.path.join(search_dir, headername) header_list = pytexutils.readfile(headerpath) header.extend(header_list) header.extend(headerinserts) bdstr = '\\begin{document}' if bdstr not in header: header.append(bdstr) self.header = txt_mixin.txt_list(header)