-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdeploy.py
89 lines (79 loc) · 2.56 KB
/
deploy.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import sys
import os
import shutil
part1='''site_name: CTGCatalog
site_author: HE Yunye
repo_name: 'GitHub'
repo_url: https://github.com/Cloufield/CTGCatalog/
edit_uri: ""
copyright: "CTGCatalog is licensed under the MIT license"
theme:
name: material
features:
- navigation.tabs
- navigation.top
- search.highlight
- search.suggest
- search.share
font:
code: Roboto Mono
text: Roboto
palette:
primary: blue
accent: blue
logo:
assets/logo.png
favicon:
assets/logo.png
extra_css:
- stylesheets/extra.css
markdown_extensions:
- toc:
toc_depth: 3
- admonition
- tables
- pymdownx.details
- pymdownx.superfences
- pymdownx.arithmatex:
generic: true
extra_javascript:
- javascripts/mathjax.js
- https://polyfill.io/v3/polyfill.min.js?features=es6
- https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
- https://unpkg.com/[email protected]/dist/tablesort.min.js
- javascripts/tablesort.js
plugins:
- search
- mkdocs-jupyter
'''
shutil.copyfile("./README.md", "./docs/index.md")
part2="nav: \n - Home : index.md\n"
for dirname in ["Tools","Sumstats","Reference_data","Visualization","Population_Genetics"]: #"Programming","NGS",
for root, dirs, files in sorted(os.walk("./"+dirname)):
# level1-folder, level2-folder, file
#print(root)
## get current directory
currentfolder = root.strip(".|/").split("/")[-1]
files.sort()
## for files in the current directory
for name in files:
## get full path for a file
file = os.path.join(root,name)
## reconstruct the name / in path to _
filerename = ("_".join(file.strip(".|/").split("/")))
## if there are subdirectories
if filerename[-2:]=="md" and len(dirs)>0:
## file sub categories
part2+=" "*2*len(file.strip(".|/").split("/"))+"- " + root.strip(".|/").split("/")[-1] +":"
part2+="\n"
## file md
part2+=" "*2*(1+len(file.strip(".|/").split("/")))+"- " + root.strip(".|/").split("/")[-1] +": "+filerename
part2+="\n"
shutil.copyfile(file, "./docs/"+filerename)
#print(filerename)
if filerename[-2:]=="md" and len(dirs)==0:
part2+=" "*2*len(file.strip(".|/").split("/"))+"- " + root.strip(".|/").split("/")[-1] +": "+filerename
part2+="\n"
shutil.copyfile(file, "./docs/"+filerename)
with open("./mkdocs.yml",mode="w") as file:
file.write(part1+part2)