Skip to content

Commit

Permalink
Update dish difficulty titles to use Chinese characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Anduin2017 committed Jun 6, 2024
1 parent d1eb29c commit d49982b
Show file tree
Hide file tree
Showing 8 changed files with 309 additions and 309 deletions.
13 changes: 7 additions & 6 deletions .github/readme-generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ async function organizeByStars(dishesFolder, starsystemFolder) {

await processFolder(dishesFolderAbs);

const starRatings = Array.from(new Set(Object.values(dishes))).sort((a, b) => b - a);
const starRatings = Array.from(new Set(Object.values(dishes))).sort((a, b) => a - b);
const navigationLinks = [];

for (const stars of starRatings) {
const starsFile = path.join(starsystemFolderAbs, `${stars}Star.md`);
const content = [`# Dishes with ${stars} Stars`, ''];
const content = [`# ${stars} 星难度菜品`, ''];
for (const [filepath, starCount] of Object.entries(dishes)) {
if (starCount === stars) {
const relativePath = path.relative(starsystemFolderAbs, filepath).replace(/\\/g, '/');
content.push(`* [${path.basename(filepath, '.md')}](./${relativePath})`);
}
}
await writeFile(starsFile, content.join('\n'), 'utf-8');
navigationLinks.push(`- [${stars} Star Dishes](${path.relative(path.dirname(README_PATH), starsFile).replace(/\\/g, '/')})`);
navigationLinks.push(`- [${stars} 星难度](${path.relative(path.dirname(README_PATH), starsFile).replace(/\\/g, '/')})`);
}

return navigationLinks;
Expand Down Expand Up @@ -180,15 +180,16 @@ async function main() {

const navigationLinks = await organizeByStars(dishesFolder, starsystemFolder);
// Debug logging to ensure navigationLinks is defined and contains data
console.log("Navigation Links:", navigationLinks);
const navigationSection = `\n## Navigation\n\n${navigationLinks.join('\n')}`;
console.log("难度索引", navigationLinks);
const navigationSection = `\n### 按难度索引\n\n${navigationLinks.join('\n')}`;

await writeFile(
README_PATH,
README_TEMPLATE
.replace('{{before}}', README_BEFORE.trim())
.replace('{{index_stars}}', navigationSection.trim())
.replace('{{main}}', README_MAIN.trim())
.replace('{{after}}', README_AFTER.trim())+ navigationSection,
.replace('{{after}}', README_AFTER.trim()),
);

await writeFile(
Expand Down
4 changes: 2 additions & 2 deletions .github/templates/readme_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

## 本地部署

如果需要在本地部署菜谱 Web 服务,可以在安装 Docker 后运行下面命令:
如果需要在本地部署菜谱 Web 服务,可以在安装 Docker 后运行下面命令:

```bash
docker pull ghcr.io/anduin2017/how-to-cook:latest
Expand All @@ -36,7 +36,7 @@ docker run -d -p 5000:5000 ghcr.io/anduin2017/how-to-cook:latest

## 菜谱

### 家常菜
{{index_stars}}

{{main}}

Expand Down
591 changes: 295 additions & 296 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion starsystem/1Star.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dishes with 1 Stars
# 1 星难度菜品

* [吐司果酱](./../dishes/breakfast/吐司果酱.md)
* [微波炉荷包蛋](./../dishes/breakfast/微波炉荷包蛋.md)
Expand Down
2 changes: 1 addition & 1 deletion starsystem/2Star.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dishes with 2 Stars
# 2 星难度菜品

* [白灼虾](./../dishes/aquatic/白灼虾/白灼虾.md)
* [蒜蓉虾](./../dishes/aquatic/蒜蓉虾/蒜蓉虾.md)
Expand Down
2 changes: 1 addition & 1 deletion starsystem/3Star.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dishes with 3 Stars
# 3 星难度菜品

* [干煎阿根廷红虾](./../dishes/aquatic/干煎阿根廷红虾/干煎阿根廷红虾.md)
* [微波葱姜黑鳕鱼](./../dishes/aquatic/微波葱姜黑鳕鱼.md)
Expand Down
2 changes: 1 addition & 1 deletion starsystem/4Star.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dishes with 4 Stars
# 4 星难度菜品

* [咖喱炒蟹](./../dishes/aquatic/咖喱炒蟹.md)
* [小龙虾](./../dishes/aquatic/小龙虾/小龙虾.md)
Expand Down
2 changes: 1 addition & 1 deletion starsystem/5Star.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Dishes with 5 Stars
# 5 星难度菜品

* [戚风蛋糕](./../dishes/dessert/戚风蛋糕/戚风蛋糕.md)
* [芋泥雪媚娘](./../dishes/dessert/芋泥雪媚娘/芋泥雪媚娘.md)
Expand Down

0 comments on commit d49982b

Please sign in to comment.