Skip to content

Commit 5a716af

Browse files
committed
docs: 更新文档生成流程和内容
- 添加 adapter_gen.py 脚本到文档生成流程 - 更新 events.md 文件,添加新参数和说明 - 修改 plugin_gen.py 中的插件添加说明,指向 Pull Request 页面 - 在 mkdocs.yml 中添加第三方适配器文档链接
1 parent 4a6cc1f commit 5a716af

7 files changed

Lines changed: 119 additions & 1 deletion

File tree

.github/workflows/docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ jobs:
3636
run: |
3737
pip install -r "./docs/requirements.txt"
3838
python ./docs/plugin_gen.py
39+
python ./docs/adapter_gen.py
3940
- run: mkdocs gh-deploy --force

docs/Adapter/Third-Party.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
comments: true
3+
hide:
4+
- navigation
5+
- toc
6+
---
7+
8+
# 第三方适配器
9+
10+
本页包含一些HuHoBot的第三方适配器
11+
12+
## 添加适配器
13+
14+
您可以在网站上添加自己的插件,只需打开一个[新Pull Request](https://github.com/HuHoBot/HuHoBot.github.io/pulls)即可。
15+
16+
## 可用适配器列表
17+
18+
<div class="grid cards" markdown>
19+
20+
- **PocketMineAdapter** <small>by Sunch233</small>
21+
22+
![Stars](https://img.shields.io/github/stars/Sunch233/HuHoBot-PocketMineAdapter?style=flat-square)
23+
![License](https://img.shields.io/github/license/Sunch233/HuHoBot-PocketMineAdapter?style=flat-square)
24+
![Last Commit](https://img.shields.io/github/last-commit/Sunch233/HuHoBot-PocketMineAdapter?style=flat-square)
25+
![Top Language](https://img.shields.io/github/languages/top/Sunch233/HuHoBot-PocketMineAdapter?style=flat-square)
26+
27+
---
28+
29+
群服互通机器人huhubot的pm解释器,api5+
30+
31+
[**:octicons-arrow-right-24: GitHub**](https://github.com/Sunch233/HuHoBot-PocketMineAdapter)
32+
33+
34+
</div>

docs/Protocol/events.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,10 @@
9797
```json5
9898
{
9999
"key":"", //查询关键词
100+
"page": 0 //页码
100101
}
101102
```
103+
-: 传入的包体可能是`key`或者`page`两者其一,需要自行判断并做出选择
102104
- 回执消息: ``
103105
- 见请求中的[查询白名单返回结果(queryWl)](requests.md)
104106

docs/adapter.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[PocketMineAdapter]
2+
description = "群服互通机器人huhubot的pm解释器,api5+"
3+
authors = ["Sunch233"]
4+
github = "https://github.com/Sunch233/HuHoBot-PocketMineAdapter"

docs/adapter_gen.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import toml
2+
import mkdocs_gen_files
3+
4+
from urllib.parse import urlparse
5+
6+
7+
def parse_github_url(url):
8+
parsed_url = urlparse(url)
9+
10+
if parsed_url.netloc != "github.com":
11+
raise ValueError("The provided URL is not a valid GitHub URL")
12+
13+
path_parts = parsed_url.path.strip("/").split("/")
14+
15+
if len(path_parts) < 2:
16+
raise ValueError("Invalid URL format. Unable to extract organization and repository names")
17+
18+
organization = path_parts[0]
19+
repository = path_parts[1]
20+
21+
return organization, repository
22+
23+
with mkdocs_gen_files.open("Adapter/Third-Party.md", "w") as f:
24+
def fp(str):
25+
print(str, file=f)
26+
27+
def el():
28+
print("", file=f)
29+
30+
fp("---")
31+
fp("comments: true")
32+
fp("hide:")
33+
fp(" - navigation")
34+
fp(" - toc")
35+
fp("---")
36+
el()
37+
38+
fp("# 第三方适配器")
39+
el()
40+
fp("本页包含一些HuHoBot的第三方适配器")
41+
el()
42+
43+
fp("## 添加适配器")
44+
el()
45+
fp("您可以在网站上添加自己的插件,只需打开一个[新Pull Request](https://github.com/HuHoBot/HuHoBot.github.io/pulls)即可。")
46+
el()
47+
48+
fp("## 可用适配器列表")
49+
el()
50+
fp("<div class=\"grid cards\" markdown>")
51+
el()
52+
53+
config = toml.load("docs/adapter.toml")
54+
for name, info in config.items():
55+
description = info["description"]
56+
authors = info["authors"]
57+
github = info["github"]
58+
user, repo = parse_github_url(github)
59+
60+
61+
fp(f"- **{name}** <small>by {", ".join(authors)}</small>")
62+
el()
63+
fp(f" ![Stars](https://img.shields.io/github/stars/{user}/{repo}?style=flat-square)")
64+
fp(f" ![License](https://img.shields.io/github/license/{user}/{repo}?style=flat-square)")
65+
fp(f" ![Last Commit](https://img.shields.io/github/last-commit/{user}/{repo}?style=flat-square)")
66+
fp(f" ![Top Language](https://img.shields.io/github/languages/top/{user}/{repo}?style=flat-square)")
67+
el()
68+
fp(" ---")
69+
el()
70+
fp(f" {description}")
71+
el()
72+
fp(f" [**:octicons-arrow-right-24: GitHub**]({github})")
73+
el()
74+
75+
el()
76+
fp("</div>")

docs/plugin_gen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def el():
4242

4343
fp("## 添加插件")
4444
el()
45-
fp("您可以在网站上添加自己的插件,只需打开一个新Issues即可。")
45+
fp("您可以在网站上添加自己的插件,只需打开一个[新Pull Request](https://github.com/HuHoBot/HuHoBot.github.io/pulls)即可。")
4646
el()
4747

4848
fp("## 可用插件列表")

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ nav:
1616
- EndStone: Adapter/EndStone.md
1717
- Allay: Adapter/Allay.md
1818
- Nukkit-MOT: Adapter/Nukkit-MOT.md
19+
- 第三方: Adapter/Third-Party.md
1920
- 附属插件开发指南:
2021
- Spigot: Develop/Spigot.md
2122
- LSE: Develop/LSE.md

0 commit comments

Comments
 (0)