def Create_Most(self, bl=True, bl_dest=None, extlist=None): index_rst = self.find_top_level_index_rst() if index_rst: rst2html_fullpath(index_rst) return self.FindSubFolders() if bl: self.Add_bottom_link(br=False, dest=bl_dest) self.AddSubFolderLinks() self.FindImages() self.GenerateHTMLs() self.AddThumbNailTable() self.Add_Other_Links(['.m4v','.mov'], "Videos:") self.Add_Other_Links(['.py'], "Python Files:") self.Add_Other_Links(['.m'], "Matlab Files:") self.Add_Other_Links(['.pdf'], "PDF Files:") #self.Add_Other_Links(['.tex'], "LaTeX Files:") self.Add_Other_Links(['.pkl'], "Pickle Files:") self.Add_Other_Links(['.html'], "HTML Files:") self.Add_Other_Links(['.avi','.mpeg','.mp3','.m4a'], "Mutli-Media Files:") self.Add_Other_Links(['.xls','.xlsx'], "Excel Files:") self.Add_Other_Links(['.txt','.csv'], "Data Files:") if bl: self.Add_bottom_link(dest=bl_dest) self.ToFile()
def make_toplevel_page(self): pat = os.path.join(self.pathin, 'index_*.rst') myfiles = glob.glob(pat) if len(myfiles) == 1: src = myfiles[0] dst = os.path.join(self.pathin, 'index.rst') shutil.copyfile(src, dst) rst2html_fullpath(dst)
def run_top_level_rst(self, add_back_link=True): pat = os.path.join(self.pathin, '*.rst') top_level_rst = glob.glob(pat) for curpath in top_level_rst: folder, name = os.path.split(curpath) if name != 'index.rst': rst2html_fullpath(curpath, add_up_link=add_back_link, \ uplink_path='index.html')
def find_top_level_index_rst(self, runrst=True, add_up_link=True): top_level_rsts = self.Find_Top_Level_Files(['*.rst']) ind = None if len(top_level_rsts) > 0: for i, curpath in enumerate(top_level_rsts): folder, name = os.path.split(curpath) if name.find('index_') > -1: dst = os.path.join(folder, 'index.rst') shutil.copyfile(curpath, dst) rst2html_fullpath(dst, add_up_link=add_up_link) ind = i if ind is not None: return top_level_rsts[ind] else: return None
def Create_Most(self, bl=True, bl_dest=None, \ extlist=['html','m4v','mov','pdf','py','m','m4a','mp3'],\ add_up_link=True): index_rst = self.find_top_level_index_rst() clean_ext_list = [] for item in extlist: if item[0] != '.': item = '.' + item clean_ext_list.append(item) if index_rst: rst2html_fullpath(index_rst, add_up_link=add_up_link) return self.FindSubFolders() if bl: self.Add_bottom_link(br=False, dest=bl_dest) self.AddSubFolderLinks() for item in clean_ext_list: label = link_dict[item] self.Add_Other_Links([item], label) if bl: self.Add_bottom_link(dest=bl_dest) self.ToFile()