Skip to content

Commit

Permalink
New lint CI. Fix some issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anduin2017 committed Mar 12, 2022
1 parent 7d90e46 commit 774420e
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 22 deletions.
56 changes: 56 additions & 0 deletions .github/manual_lint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// fetch all .md files.
// Check it's content.
// Console.LogError for errors.


const glob = require("glob");
const fs = require("fs");
var path = require('path');


var getDirectories = function (src, callback) {
glob(src + '../../dishes/**/*.md', callback);
};

getDirectories(__dirname, function (err, res) {
res.forEach(filePath => {
// console.log("Linting file: " + filePath + " ...");

fs.readFile(filePath, 'utf8' , (err, data) => {
data = data.replace('\r\n', '\n');
data = data.replace('\r', '\n');

dataLines = data.split('\n');
var filename = path.parse(filePath).base.replace(".md","");

titles = dataLines.filter(t => t.startsWith('#'));
secondTitles = titles
.filter(t => t.startsWith('## '));

if (titles[0].trim() != "# " + filename + "的做法") {
console.error(`File ${filePath} is invalid! It's title should be: ${"# " + filename + "的做法"}! It was ${titles[0].trim()}!`);
return;
}
if (secondTitles.length != 4) {
console.error(`File ${filePath} is invalid! It doesn't has 4 second titles!`);
return;
}
if (secondTitles[0].trim() != "## 必备原料和工具") {
console.error(`File ${filePath} is invalid! The first title is NOT 必备原料和工具! It was ${secondTitles[0]}!`);
return;
}
if (secondTitles[1].trim() != "## 计算") {
console.error(`File ${filePath} is invalid! The second title is NOT 计算!`);
return;
}
if (secondTitles[2].trim() != "## 操作") {
console.error(`File ${filePath} is invalid! The thrid title is NOT 操作!`);
return;
}
if (secondTitles[3].trim() != "## 附加内容") {
console.error(`File ${filePath} is invalid! The fourth title is NOT 附加内容!`);
return;
}
});
});
});
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v2
with:
node-version: '16'
cache: 'npm'
- uses: actions/checkout@v2
- name: Install packages
run: sudo gem install mdl
- name: Lint markdown files
run: mdl . -r ~MD036,~MD024,~MD004,~MD029
- run: pip install -r requirements.txt
- run: mkdocs build --strict
- run: npm install
- run: node .github/manual_lint.js
# Suppress 036 Emphasis used instead of a header
# Suppress 024 Multiple headers with the same content
4 changes: 2 additions & 2 deletions dishes/aquatic/红烧鱼头.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
- 如果你没有使用过菜刀剁过肉类食物,那么我并不推荐你使用该菜单!!!
- 在操作中,锋利的菜刀可能会划伤你的手指,请一定要小心。

## 必备原料与工具
## 必备原料和工具

- 注:如果有可能,尽量另准备一把菜刀,超市或市场上均有廉价且刀片更厚的菜刀,刀片厚度在 5-7mm 为最佳。
- 大葱、姜、大蒜、香菜、美人椒
Expand Down Expand Up @@ -38,7 +38,7 @@
* 将美人椒切为厚度为 3mm 左右的辣椒圈。
* 干辣椒切四段。

## 腌制鱼头
### 腌制鱼头

* 注:下文所述的鱼身是购买鱼头时所附带的鱼肉。
* 将鱼头去鳞,清洗鱼头处未被清理干净的内脏。
Expand Down
2 changes: 1 addition & 1 deletion dishes/aquatic/红烧鲤鱼.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 红烧鲤鱼的做法

## 必备原料与工具
## 必备原料和工具

- 大葱、姜、大蒜、干辣椒
- 油、盐、生抽、老抽、陈醋、蚝油、料酒、白糖
Expand Down
2 changes: 1 addition & 1 deletion dishes/meat_dish/红烧肉/南派红烧肉.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

这份红烧肉教程是一道新手不败的菜谱。配着米饭好吃的停不下来,香糯无敌棒色泽诱人肥而不腻

## 必备原料与工具
## 必备原料和工具

* 注:如果有可能,请尽量把刀磨的锋利一些。
* 工具:``(砂锅为宜,铝锅其次,高压锅也可以,最好不要铁锅、铜锅)、````
Expand Down
2 changes: 1 addition & 1 deletion dishes/meat_dish/红烧肉/简易红烧肉.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

![红烧肉成品](./001.jpg)

## 必备原料与工具
## 必备原料和工具

- 注:如果有可能,请尽量把刀磨的锋利一些。
- 主料:`大肉``鸡蛋`(可选)、`豆皮`(可选)
Expand Down
5 changes: 1 addition & 4 deletions dishes/staple/炒馍.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@

使用上述条件,计算出计划使用的原材料比例。

## 准备原料
## 操作

* 将馒头切成小块或小片。
* 选有鸡蛋的话将鸡蛋打进碗里,打散(可加盐和五香粉各 1g 或不加,等炒的过程中加)。
* 鸡蛋浇在馒头上,拌匀,鸡蛋不宜过多。

## 操作

* 大火热锅,倒入食用油(不锈钢锅怕伤锅的话可以先倒油,烧至油热也可也可)
* 将馍丁放进去翻炒,翻炒均匀。
* 将火调小,炒至馍丁呈金黄色。
Expand Down
2 changes: 1 addition & 1 deletion dishes/staple/烙饼/烙饼.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 烙饼的做法

## 必备原料与工具
## 必备原料和工具

*
* 面粉
Expand Down
2 changes: 1 addition & 1 deletion dishes/staple/米饭/煮锅蒸米饭.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# 煮锅蒸米饭的做法

## 必备的原料和工具
## 必备原料和工具

- 北方大米
-
Expand Down
4 changes: 2 additions & 2 deletions dishes/staple/麻油拌面.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# 省吃俭用懒人麻油拌面的做法
# 麻油拌面的做法

想必大家都会有节约开销的时刻吧,附上个人耐吃又省钱的食谱。不需要太多的步骤简单的煮,捞,吃。
省吃俭用懒人的菜:麻油拌面:想必大家都会有节约开销的时刻吧,附上个人耐吃又省钱的食谱。不需要太多的步骤简单的煮,捞,吃。

- 单身的朋友懒惰出门,又不想花钱,简简单单就一餐。
- 非单身的朋友想存钱,让女友花钱,简简单单就一餐。
Expand Down
4 changes: 3 additions & 1 deletion dishes/vegetable_dish/上汤娃娃菜/上汤娃娃菜.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# 上汤娃娃菜的做法 (素菜|减肥餐)
# 上汤娃娃菜的做法

上汤娃娃菜的做法 (素菜|减肥餐)

## 必备原料和工具

Expand Down
4 changes: 2 additions & 2 deletions dishes/vegetable_dish/椒盐玉米/椒盐玉米.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# 椒盐玉米的做法

## 必备的原料和工具
## 必备原料和工具

- 玉米粒
- 椒盐
Expand All @@ -19,7 +19,7 @@
- 淀粉 适量
- 椒盐粉 半勺(备用)

## 做法
## 操作

- 玉米粒都是剥好的,直接解冻即可,温水泡 15 分钟或者灶上开水煮 5 分钟。
- 拿出一个簸箕我们将其假设为 BoxA,垫上吸油纸,倒进解冻好的玉米粒。
Expand Down
2 changes: 1 addition & 1 deletion dishes/vegetable_dish/红烧茄子.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 红烧茄子的做法

## 原料与工具
## 必备原料和工具

- 大蒜
- 大葱
Expand Down
13 changes: 12 additions & 1 deletion dishes/vegetable_dish/蒲烧茄子.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# 蒲烧茄子🍆的做法
# 蒲烧茄子的做法

众所皆知,茄子🍆和土豆🥔是两种荤菜。这一道蒲烧茄子,从外观上之于鳗鱼正如`土豆炖.*`中的生姜之于土豆。

## 必备原料和工具

- 茄子
- 蒲烧汁
- 蜂蜜
- 白糖
- 生抽
- 老抽
- 料酒
-

## 计算

- 根据锅的类型适量的油(不粘锅:油汇聚成滴后要散布在茄子的面积 || 铁锅:摊开后油可以刚好覆盖锅底)
- 1 个长的上小下大的茄子(注意不要使用浙茄和圆茄)
- 1 份蒲烧汁
Expand Down
2 changes: 1 addition & 1 deletion dishes/vegetable_dish/虎皮青椒/虎皮青椒.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# 虎皮青椒的做法

## 必备的原料和工具
## 必备原料和工具

青椒若干,大蒜 2 瓣,香醋 15ml,白糖 15g,生抽 5ml,油 15ml,盐少许。

Expand Down
2 changes: 1 addition & 1 deletion dishes/vegetable_dish/西红柿炒鸡蛋.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 西红柿鸡蛋的做法
# 西红柿炒鸡蛋的做法

西红柿炒蛋是中国家常几乎最常见的一道菜肴。它的原材料易于搜集,制作步骤也较为简单,所以非常适合新厨师上手,是很多人学习做菜时做的第一道菜。

Expand Down
4 changes: 3 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"name": "how-to-cook",
"description": "程序员在家做饭方法指南。Programmer's guide about how to cook at home (Chinese).",
"version": "1.0.0",
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/Anduin2017/HowToCook.git"
Expand All @@ -24,5 +23,8 @@
"textlint": "^12.1.0",
"textlint-rule-ja-space-between-half-and-full-width": "^2.2.0",
"textlint-rule-zh-half-and-full-width-bracket": "^1.1.0"
},
"devDependencies": {
"glob": "^7.2.0"
}
}

0 comments on commit 774420e

Please sign in to comment.