def genFileList(path, files): keys = [i for i in files if i[0] != '.'] link = {i: os.path.join(path, i) for i in keys} lst = [ LIITEM.format(icon=getIcon(key), name=key + '---({})'.format(getSize(link[key])), path=os.path.join(PATH, link[key])) for key in keys ] if lst == []: lst.append('<li><i class="fa fa-meh-o"></i> None</li>') return '\n'.join(lst)
def genFileList(path,files,tar = TARDIR): files = [i for i in files if not i.startswith('.')] link = {} for k in files: if k.endswith('.md'): shutil.copy(os.path.join(path,k),tar) link[k] = k[:-3] + '.html' else: link[k] = os.path.join(PATH,path,k) lst = [LIITEM.format(icon=getIcon(key),name = key+'---({})'.format(getSize(os.path.join(path,key))),path = link[key]) for key in files] if lst==[]: lst.append('<li><i class="fa fa-meh-o"></i> None</li>') return '\n'.join(lst)