1
0
mirror of synced 2025-11-06 05:10:37 +08:00

Update dish difficulty titles to use Chinese characters

This commit is contained in:
Anduin
2024-06-06 17:12:40 +00:00
parent 2068cade6e
commit 035cf7c177
8 changed files with 309 additions and 309 deletions

View File

@@ -103,12 +103,12 @@ 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, '/');
@@ -116,7 +116,7 @@ async function organizeByStars(dishesFolder, starsystemFolder) {
}
}
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;
@@ -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(

View File

@@ -15,7 +15,7 @@
## 本地部署
如果需要在本地部署菜谱 Web 服务,可以在安装 Docker 后运行下面命令:
如果需要在本地部署菜谱 Web 服务,可以在安装 Docker 后运行下面命令:
```bash
docker pull ghcr.io/anduin2017/how-to-cook:latest
@@ -36,7 +36,7 @@ docker run -d -p 5000:5000 ghcr.io/anduin2017/how-to-cook:latest
## 菜谱
### 家常菜
{{index_stars}}
{{main}}