mirror of
https://github.com/QingdaoU/oj-docs.git
synced 2024-12-28 23:41:43 +00:00
update
This commit is contained in:
parent
31e77059f0
commit
45ec83cb29
49
gen.py
Normal file
49
gen.py
Normal file
@ -0,0 +1,49 @@
|
||||
# coding=utf-8
|
||||
import yaml
|
||||
|
||||
with open("mkdocs_template.yml", "r") as f:
|
||||
raw_data = yaml.load(f)
|
||||
data = raw_data["pages"]
|
||||
|
||||
|
||||
def one(item, depth=0, result=""):
|
||||
for k, v in item.iteritems():
|
||||
if isinstance(v, basestring):
|
||||
result += " ".join([" " * depth, "-", "[" + k + "](/" + v.rstrip("index.md").rstrip(".md") + ")\n"])
|
||||
elif isinstance(v, list):
|
||||
result += " ".join([" " * depth, "-", k, "\n"])
|
||||
for v_item in v:
|
||||
result += one(v_item, depth+4)
|
||||
return result
|
||||
|
||||
|
||||
def get_all(l):
|
||||
result = ""
|
||||
for _ in l:
|
||||
result += one(_)
|
||||
return result
|
||||
|
||||
new_data = []
|
||||
for _ in data:
|
||||
name = list(_.iteritems())[0][0]
|
||||
if name == "Home":
|
||||
new_data.append(_)
|
||||
content = get_all(data)
|
||||
with open("src/index_template.md", "r") as f:
|
||||
old = f.read()
|
||||
old = old.replace("<!--TOC-->", content.encode("utf-8"))
|
||||
with open("src/index.md", "w") as f:
|
||||
f.write(old)
|
||||
else:
|
||||
content = one(_)
|
||||
path = name + "/index.md"
|
||||
with open("src/" + path, "w") as f:
|
||||
f.write("# Table of contents\n" + content.encode("utf-8"))
|
||||
tmp = [{"index": path}]
|
||||
tmp.extend(_[name])
|
||||
new_data.append({name: tmp})
|
||||
|
||||
raw_data["pages"] = new_data
|
||||
|
||||
with open("mkdocs.yml", "w") as f:
|
||||
yaml.dump(raw_data, f, default_flow_style=False)
|
19
mkdocs.yml
19
mkdocs.yml
@ -1,19 +0,0 @@
|
||||
site_name: Online Judge Docs
|
||||
theme: yeti
|
||||
docs_dir: 'src'
|
||||
site_dir: 'docs'
|
||||
pages:
|
||||
- Home: 'index.md'
|
||||
- Judger:
|
||||
# - 'Index': 'judger/index.md'
|
||||
- 'English':
|
||||
- 'API': 'judger/English/index.md'
|
||||
- JudgeServer:
|
||||
# - 'Index': 'judge_server/index.md'
|
||||
- 'English':
|
||||
- 'API': 'judge_server/English/index.md'
|
||||
- 'Deploy': 'judge_server/English/deploy.md'
|
||||
# - '中文':
|
||||
# - 'API': 'judge_server/Chinese/index.md'
|
||||
# - '部署': 'judge_server/Chinese/deploy.md'
|
||||
|
16
mkdocs_template.yml
Normal file
16
mkdocs_template.yml
Normal file
@ -0,0 +1,16 @@
|
||||
pages:
|
||||
- Home: index.md
|
||||
- Judger:
|
||||
- English:
|
||||
- API: Judger/English/index.md
|
||||
- JudgeServer:
|
||||
- English:
|
||||
- API: JudgeServer/English/index.md
|
||||
- Deploy: JudgeServer/English/deploy.md
|
||||
- 中文:
|
||||
- API: JudgeServer/Chinese/index.md
|
||||
- 部署: JudgeServer/Chinese/deploy.md
|
||||
docs_dir: src
|
||||
site_dir: docs
|
||||
site_name: Online Judge Docs
|
||||
theme: yeti
|
8
src/JudgeServer/index.md
Normal file
8
src/JudgeServer/index.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Table of contents
|
||||
- JudgeServer
|
||||
- English
|
||||
- [API](/JudgeServer/English/)
|
||||
- [Deploy](/JudgeServer/English/deploy)
|
||||
- 中文
|
||||
- [API](/JudgeServer/Chinese/)
|
||||
- [部署](/JudgeServer/Chinese/deploy)
|
@ -3,3 +3,5 @@
|
||||
目前此处的文档均为未公开发布版本的,最新release的版本请参考github。
|
||||
|
||||
https://github.com/QingdaoU
|
||||
|
||||
<!--TOC-->
|
@ -1,7 +0,0 @@
|
||||
# 中文版本
|
||||
|
||||
[链接](Chinese)
|
||||
|
||||
# English Version
|
||||
|
||||
[link](English)
|
@ -1,7 +1,4 @@
|
||||
# 中文版本
|
||||
|
||||
[链接](Chinese)
|
||||
|
||||
# English Version
|
||||
|
||||
[link](English)
|
||||
# Table of contents
|
||||
- Judger
|
||||
- English
|
||||
- [API](/Judger/English/)
|
||||
|
Loading…
Reference in New Issue
Block a user