forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: documentation prioritizes English and maintains only one route …
…list (DIYgod#13075)
- Loading branch information
Showing
118 changed files
with
8,646 additions
and
15,966 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,49 @@ | ||
<!-- | ||
如有疑问,请参考 https://docs.rsshub.app/joinus/new-rss/submit-route | ||
Reference: https://docs.rsshub.app/en/joinus/new-rss/submit-route | ||
Reference: https://docs.rsshub.app/joinus/new-rss/submit-route | ||
如有疑问,请参考 https://docs.rsshub.app/zh/joinus/new-rss/submit-route | ||
--> | ||
|
||
## 该 PR 相关 Issue / Involved Issue | ||
## Involved Issue / 该 PR 相关 Issue | ||
|
||
Close # | ||
|
||
## 路由地址示例 / Example for the Proposed Route(s) | ||
## Example for the Proposed Route(s) / 路由地址示例 | ||
|
||
<!-- | ||
Please include route starts with /, with all required and optional parameters. | ||
Fail to comply will result in your pull request being closed automatically. | ||
请在 `routes` 区域填写以 / 开头的完整路由地址,否则你的 PR 将会被无条件关闭。 | ||
如果路由包含在文档中列出可以完全穷举的参数(例如分类),请依次全部列出。 | ||
Please include route starts with /, with all required and optional parameters. Fail to comply will result in your pull request being closed automatically. | ||
```route | ||
/some/route | ||
/some/other/route | ||
/dont/use/this/or/modify/it | ||
/use/the/fenced/code/block/below | ||
``` | ||
如果你的 PR 与路由无关, 请在 `routes` 区域 填写 `NOROUTE`,而不是直接删除 `routes` 区域。否则你的 PR 将会被无条件关闭。 | ||
If your changes are not related to route, please fill in `routes` section with `NOROUTE`. Fail to comply will result in your PR being closed. | ||
如果你的 PR 与路由无关, 请在 `routes` 区域 填写 `NOROUTE`,而不是直接删除 `routes` 区域。否则你的 PR 将会被无条件关闭。 | ||
--> | ||
|
||
```routes | ||
``` | ||
|
||
## 新 RSS 路由检查表 / New RSS Route Checklist | ||
## New RSS Route Checklist / 新 RSS 路由检查表 | ||
|
||
- [ ] 新的路由 New Route | ||
- [ ] 跟随 [v2 路由规范](https://docs.rsshub.app/joinus/advanced/script-standard) Follows [v2 Script Standard](https://docs.rsshub.app/en/joinus/advanced/script-standard) | ||
- [ ] 文档说明 Documentation | ||
- [ ] 中文文档 CN | ||
- [ ] 英文文档 EN | ||
- [ ] 全文获取 full article | ||
- [ ] 使用缓存 Use cache | ||
- [ ] 反爬/频率限制 anti-bot or rate limit? | ||
- [ ] 如果有, 是否有对应的措施? If yes, do your code reflect this sign? | ||
- [ ] [日期和时间](https://docs.rsshub.app/joinus/advanced/pub-date) [date and time](https://docs.rsshub.app/en/joinus/advanced/pub-date) | ||
- [ ] 可以解析 Parsed | ||
- [ ] 时区正确 Correct time zone | ||
- [ ] 添加了新的包 New package added | ||
- [ ] New Route / 新的路由 | ||
- [ ] Follows [v2 Script Standard](https://docs.rsshub.app/joinus/advanced/script-standard) / 跟随 [v2 路由规范](https://docs.rsshub.app/zh/joinus/advanced/script-standard) | ||
- [ ] Documentation / 文档说明 | ||
- [ ] EN / 英文文档 | ||
- [ ] CN / 中文文档 | ||
- [ ] Full text / 全文获取 | ||
- [ ] Use cache / 使用缓存 | ||
- [ ] Anti-bot or rate limit / 反爬/频率限制 | ||
- [ ] If yes, do your code reflect this sign? / 如果有, 是否有对应的措施? | ||
- [ ] [Date and time](https://docs.rsshub.app/joinus/advanced/pub-date) / [日期和时间](https://docs.rsshub.app/zh/joinus/advanced/pub-date) | ||
- [ ] Parsed / 可以解析 | ||
- [ ] Correct time zone / 时区正确 | ||
- [ ] New package added / 添加了新的包 | ||
- [ ] `Puppeteer` | ||
|
||
## 说明 / Note | ||
## Note / 说明 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
## 请参见[参与我们](https://docs.rsshub.app/joinus/quick-start) | ||
## 请参见[参与我们](https://docs.rsshub.app/zh/joinus/quick-start) | ||
|
||
## Please refer to [Join Us](https://docs.rsshub.app/en/joinus/quick-start) | ||
## Please refer to [Join Us](https://docs.rsshub.app/joinus/quick-start) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
const fs = require('fs'); | ||
|
||
function parse(data) { | ||
const lines = data.split('\n'); | ||
|
||
const result = { | ||
h1: '', | ||
h2: [], | ||
}; | ||
let current = ''; | ||
|
||
lines.forEach((line) => { | ||
if (line.startsWith('# ')) { | ||
result.h1 = line.replace(/^# /, ''); | ||
result.h1 = result.h1.replace(/ {([^}])*}$/, ''); | ||
} else if (line.startsWith('## ')) { | ||
let h2 = line.replace(/^## /, ''); | ||
// h2 = h2.replace(/ {([^}])*}$/, ''); | ||
current = { | ||
h2, | ||
content: '', | ||
h3: [], | ||
}; | ||
result.h2.push(current); | ||
} else if (line.startsWith('### ')) { | ||
let h3 = line.replace(/^### /, ''); | ||
// h3 = h3.replace(/ {([^}])*}$/, ''); | ||
current = { | ||
h3, | ||
content: '', | ||
}; | ||
result.h2[result.h2.length - 1].h3.push(current); | ||
} else if (current) { | ||
current.content += line + '\n'; | ||
} | ||
}); | ||
|
||
result.h2.forEach((item) => { | ||
item.content = item.content.trim(); | ||
item.h3.forEach((h3) => { | ||
h3.content = h3.content.trim(); | ||
h3.id = h3.content.match(/path="([^"]+)"/)?.[1]; | ||
if (!h3.id) { | ||
console.log('no id', h3.content); | ||
} | ||
}); | ||
}); | ||
|
||
return result; | ||
|
||
// console.log(JSON.stringify(result, null, 2)); | ||
} | ||
|
||
function parseMd(name) { | ||
const cn = fs.readFileSync(`./docs/routes/${name}.md`, 'utf8'); | ||
const cnParsed = parse(cn); | ||
|
||
// const en = fs.readFileSync(`./i18n/en/docusaurus-plugin-content-docs/current/routes/${name}.md`, 'utf8') | ||
// const enParsed = parse(en); | ||
|
||
// cnParsed.h1 = enParsed.h1 | ||
|
||
// enParsed.h2.forEach((item, index) => { | ||
// item.h3.forEach((h3) => { | ||
// if (h3.id) { | ||
// let found = false | ||
// cnParsed.h2.forEach((cnitem, index) => { | ||
// cnitem.h3.forEach((cnh3) => { | ||
// if (!found && cnh3.id === h3.id) { | ||
// found = true | ||
// console.log('found', h3.id) | ||
// cnh3.content = h3.content | ||
// cnh3.h3 = h3.h3 | ||
// cnitem.content = item.content | ||
// cnitem.h2 = item.h2 | ||
// } | ||
// }) | ||
// }) | ||
// if (!found) { | ||
// console.log('not found', h3.id) | ||
// cnParsed.h2.push(item) | ||
// } | ||
// } | ||
// }) | ||
// }) | ||
|
||
let newContent = `import Route from '@site/src/components/Route';\n\n` + `# ${cnParsed.h1}\n\n`; | ||
cnParsed.h2.forEach((item) => { | ||
newContent += `## ${item.h2}\n\n`; | ||
if (item.content) { | ||
newContent += `${item.content}\n\n`; | ||
} | ||
item.h3.forEach((h3) => { | ||
newContent += `### ${h3.h3}\n\n`; | ||
newContent += `${h3.content}\n\n`; | ||
}); | ||
}); | ||
fs.writeFile(`./docs/routes/${name}.md`, newContent, (err) => { | ||
if (err) throw err; | ||
console.log('The file has been saved!'); | ||
}); | ||
// fs.writeFile(`./docs/routes/${name}.json`, JSON.stringify(cnParsed, null, 2), (err) => { | ||
// if (err) throw err; | ||
// console.log('The file has been saved!'); | ||
// }); | ||
} | ||
|
||
[ | ||
'routes/social-media', | ||
'routes/new-media', | ||
'routes/traditional-media', | ||
'routes/bbs', | ||
'routes/blog', | ||
'routes/programming', | ||
'routes/design', | ||
'routes/live', | ||
'routes/multimedia', | ||
'routes/picture', | ||
'routes/anime', | ||
'routes/program-update', | ||
'routes/university', | ||
'routes/forecast', | ||
'routes/travel', | ||
'routes/shopping', | ||
'routes/game', | ||
'routes/reading', | ||
'routes/government', | ||
'routes/study', | ||
'routes/journal', | ||
'routes/finance', | ||
'routes/other', | ||
].map((name) => parseMd(name.replace(/^routes\//, ''))); |
Oops, something went wrong.