Skip to content

Commit

Permalink
docs: documentation prioritizes English and maintains only one route …
Browse files Browse the repository at this point in the history
…list (DIYgod#13075)
  • Loading branch information
DIYgod authored Aug 20, 2023
1 parent e62b65d commit 8a58d74
Show file tree
Hide file tree
Showing 118 changed files with 8,646 additions and 15,966 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/rss_request_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body:
Please ensure the RSS proposal is not listed in [documentation](https://docs.rsshub.app/en) or [issue](https://github.com/DIYgod/RSSHub/issues), website doesn't provide this kind of RSS feed, and provide all the information required by this template.
Otherwise the issue will be closed immediately.
We are flooded with feature requests and short-handed, please try to make it yourself, the [guide](https://docs.rsshub.app/en/joinus) is a good place to start. Submit a pull request when done!
We are flooded with feature requests and short-handed, please try to make it yourself, the [guide](https://docs.rsshub.app/joinus) is a good place to start. Submit a pull request when done!
- type: dropdown
id: category
Expand Down
44 changes: 23 additions & 21 deletions .github/PULL_REQUEST_TEMPLATE.md
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 / 说明
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
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)
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ RSSHub 是一个开源、简单易用、易于扩展的 RSS 生成器,可以
<a href="https://xlog.app/" target="_blank"><img height="100px" src="https://i.imgur.com/JuhHTKD.png"></a>
</p>

[![](https://opencollective.com/static/images/become_sponsor.svg)](https://docs.rsshub.app/en/support/)
[![](https://opencollective.com/static/images/become_sponsor.svg)](https://docs.rsshub.app/support/)

### Contributors

Expand All @@ -62,21 +62,21 @@ Logo designer [sheldonrrr](https://dribbble.com/sheldonrrr)

We welcome all pull requests. Suggestions and feedback are also welcomed [here](https://github.com/DIYgod/RSSHub/issues).

Refer to [Join Us](https://docs.rsshub.app/en/joinus/quick-start)
Refer to [Join Us](https://docs.rsshub.app/joinus/quick-start)

[参与我们](https://docs.rsshub.app/joinus/quick-start)
[参与我们](https://docs.rsshub.app/zh/joinus/quick-start)

## Deployment

Refer to [Deployment](https://docs.rsshub.app/en/install/)
Refer to [Deployment](https://docs.rsshub.app/install/)

[部署](https://docs.rsshub.app/install/)
[部署](https://docs.rsshub.app/zh/install/)

## Support RSSHub

Refer to [Support RSSHub](https://docs.rsshub.app/en/support/)
Refer to [Support RSSHub](https://docs.rsshub.app/support/)

[支持 RSSHub](https://docs.rsshub.app/support/)
[支持 RSSHub](https://docs.rsshub.app/zh/support/)

RSSHub is open source and completely free under the MIT license. However, just like any other open source project, as the project grows, the hosting, development and maintenance requires funding support.

Expand Down
12 changes: 6 additions & 6 deletions assets/radar-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
},
'alter-shanghai.cn': { _name: 'Alter', '.': [{ title: '新闻', docs: 'https://docs.rsshub.app/routes/shopping#alter-zhong-guo', source: '/cn/news', target: '/alter-cn/news' }] },
'itslide.com': { _name: 'ITSlide', www: [{ title: '最新', docs: 'https://docs.rsshub.app/routes/programming#itslide', source: '/*', target: '/itslide/new' }] },
'leboncoin.fr': { _name: 'leboncoin', www: [{ title: 'ads', docs: 'https://docs.rsshub.app/routes/en/shopping#leboncoin', source: '/recherche', target: (params, url) => '/leboncoin/ad/' + url.split('?')[1] }] },
'leboncoin.fr': { _name: 'leboncoin', www: [{ title: 'ads', docs: 'https://docs.rsshub.app/routes/shopping#leboncoin', source: '/recherche', target: (params, url) => '/leboncoin/ad/' + url.split('?')[1] }] },
'yuancheng.work': {
_name: '远程.work',
'.': [
Expand Down Expand Up @@ -312,13 +312,13 @@
'umass.edu': {
_name: 'UMASS Amherst',
ece: [
{ title: 'ECE News', docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst', source: '/news', target: '/umass/amherst/ecenews' },
{ title: 'ECE Seminar', docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst', source: '/seminars', target: '/umass/amherst/eceseminar' },
{ title: 'ECE News', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/news', target: '/umass/amherst/ecenews' },
{ title: 'ECE Seminar', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/seminars', target: '/umass/amherst/eceseminar' },
],
'www.cics': [{ title: 'CICS News', docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst', source: '/news', target: '/umass/amherst/csnews' }],
'www.cics': [{ title: 'CICS News', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/news', target: '/umass/amherst/csnews' }],
www: [
{ title: 'IPO Events', docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst', source: '/ipo/iss/events', target: '/umass/amherst/ipoevents' },
{ title: 'IPO Featured Stories', docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst', source: '/ipo/iss/featured-stories', target: '/umass/amherst/ipostories' },
{ title: 'IPO Events', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/ipo/iss/events', target: '/umass/amherst/ipoevents' },
{ title: 'IPO Featured Stories', docs: 'http://docs.rsshub.app/routes/university#umass-amherst', source: '/ipo/iss/featured-stories', target: '/umass/amherst/ipostories' },
],
},
'bjeea.com': {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (config.enableCluster && cluster.isMaster && process.env.NODE_ENV !== 'test'
}

logger.info('🎉 RSSHub start! Cheers!');
logger.info('💖 Can you help keep this open source project alive? Please sponsor 👉 https://docs.rsshub.app/en/support');
logger.info('💖 Can you help keep this open source project alive? Please sponsor 👉 https://docs.rsshub.app/support');

module.exports = server;
}
12 changes: 6 additions & 6 deletions lib/radar-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ module.exports = {
www: [
{
title: 'ads',
docs: 'https://docs.rsshub.app/routes/en/shopping#leboncoin',
docs: 'https://docs.rsshub.app/routes/shopping#leboncoin',
source: '/recherche',
target: (params, url) => '/leboncoin/ad/' + url.split('?')[1],
},
Expand Down Expand Up @@ -817,35 +817,35 @@ module.exports = {
ece: [
{
title: 'ECE News',
docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst',
docs: 'http://docs.rsshub.app/routes/university#umass-amherst',
source: '/news',
target: '/umass/amherst/ecenews',
},
{
title: 'ECE Seminar',
docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst',
docs: 'http://docs.rsshub.app/routes/university#umass-amherst',
source: '/seminars',
target: '/umass/amherst/eceseminar',
},
],
'www.cics': [
{
title: 'CICS News',
docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst',
docs: 'http://docs.rsshub.app/routes/university#umass-amherst',
source: '/news',
target: '/umass/amherst/csnews',
},
],
www: [
{
title: 'IPO Events',
docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst',
docs: 'http://docs.rsshub.app/routes/university#umass-amherst',
source: '/ipo/iss/events',
target: '/umass/amherst/ipoevents',
},
{
title: 'IPO Featured Stories',
docs: 'http://docs.rsshub.app/en/routes/university#umass-amherst',
docs: 'http://docs.rsshub.app/routes/university#umass-amherst',
source: '/ipo/iss/featured-stories',
target: '/umass/amherst/ipostories',
},
Expand Down
4 changes: 2 additions & 2 deletions website/docs/.format/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const loopNav = (nav, lang) =>
* Iterate config and build document object:
* E.g.
* {
path: 'docs/en/other.md', <-- full path here
path: 'docs/other.md', <-- full path here
type: 'route', <--- Defined in file.js
lang: 'en' <-- Defined in file.js
}
Expand All @@ -65,7 +65,7 @@ const buildFileList = async () => {
.concat(
config.guideSidebar[2].items.map((item) => ({
type: file.ROUTE_TYPE,
path: path.resolve(__dirname, '../../i18n/en/docusaurus-plugin-content-docs/current', `./${item}.md`),
path: path.resolve(__dirname, '../../i18n/docusaurus-plugin-content-docs/current', `./${item}.md`),
lang: 'en-US',
}))
);
Expand Down
132 changes: 132 additions & 0 deletions website/docs/.format/tojson.js
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\//, '')));
Loading

0 comments on commit 8a58d74

Please sign in to comment.