Skip to content

Commit 04d01dd

Browse files
committed
Update pages for markdown
1 parent bc56e5d commit 04d01dd

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

utils/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</div>
3939
4040
## 说明
41-
下面列表根据拼音排序,可点击链接下载二进制文件,或者打开文本文件。<a href="{DOWNLOAD}" style="color:red" target="_black">点击这里</a>**下载当前整个文件夹**(此功能由 [DownGit](http://downgit.zhoudaxiaa.com) 提供)。此页面[mbinary](https://mbinary.xyz) 制作
41+
下面列表根据拼音排序,可点击下面的的链接下载二进制文件,或者打开文本文件。<a href="{DOWNLOAD}" style="color:red;text-decoration:underline;" target="_black">点击这里</a>**下载当前整个文件夹**(此功能由 [DownGit](http://downgit.zhoudaxiaa.com) 提供)。此页面由 [mbinary](https://mbinary.xyz) 制作
4242
4343
## Directories
4444
<ul>{dirLst}</ul>

utils/genIndex.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,12 @@ def genIndex(path,dirs,files,htmlTemp = HTML):
8585
#<hr>\n<span style="color:orange;text-align:center;">Read Me</span>\n<hr>\n
8686
md = '\n<h1 style="color:red;text-align:center;">Read Me</h1>\n'+f.read()
8787
cur = getPath(path)
88-
dirLst = genDirectoryList(path,dirs)
89-
fileLst = genFileList(path,files)
90-
cont = htmlTemp.format(DOWNLOAD=DOWNLOAD+path,cur=cur,dirLst = dirLst,fileLst = fileLst,readme=md2html(md))
9188
tar = os.path.join(TARDIR ,path)
9289
if not os.path.exists(tar):os.mkdir(tar)
90+
91+
dirLst = genDirectoryList(path,dirs)
92+
fileLst = genFileList(path,files,tar)
93+
cont = htmlTemp.format(DOWNLOAD=DOWNLOAD+path,cur=cur,dirLst = dirLst,fileLst = fileLst,readme=md2html(md))
9394
filename = os.path.join(tar, NAME)
9495
with open(filename,'w') as f:
9596
f.write(cont)
@@ -106,10 +107,16 @@ def getPath(path):
106107
return '/'.join(res[::-1])
107108

108109
LIITEM = '<li><a href="{path}"><i class="fa fa-{icon}"></i>&nbsp;{name}</a></li>'
109-
def genFileList(path,files):
110-
keys=[i for i in files if i[0]!='.']
111-
link= {i:os.path.join(path,i) for i in keys}
112-
lst = [LIITEM.format(icon=getIcon(key),name = key+'---({})'.format(getSize(link[key])),path = os.path.join(PATH,link[key])) for key in keys]
110+
def genFileList(path,files,tar = TARDIR):
111+
files = [i for i in files if not i.startswith('.')]
112+
link = {}
113+
for k in files:
114+
if k.endswith('.md'):
115+
shutil.copy(os.path.join(path,k),tar)
116+
link[k] = k[:-3] + '.html'
117+
else:
118+
link[k] = os.path.join(PATH,path,k)
119+
lst = [LIITEM.format(icon=getIcon(key),name = key+'---({})'.format(getSize(os.path.join(path,key))),path = link[key]) for key in files]
113120
if lst==[]: lst.append('<li><i class="fa fa-meh-o"></i>&nbsp;None</li>')
114121
return '\n'.join(lst)
115122

0 commit comments

Comments
 (0)