feat: 测试开发学习路径上线阶段 2 模块 3、4(26 章 / 120 小节)

- 新增 modules/s2-03-api-framework(接口自动化测试框架,13 章 / 60 小节)
- 新增 modules/s2-04-ui-automation(UI 自动化:Playwright 与 Selenium,13 章 / 60 小节)
- index.html 的 PAGES 登记 s2-2 / s2-3;modules-plan.json 完善这两个模块的导语
- 工具链修正:链接检查跳过 pre 内部(代码块里的 href 文本是被讲的文本,不是死链)
- 工具链修正:模块目录页「约 N 千字」改为只数正文(剥掉侧栏目录树与代码块),全站口径统一
- README 更新进度表、阶段 2 模块表与目录结构
- 自检:check-chapter --strict 26 页通过、check-pages 163 页通过、check-glossary 162 页无漂移、portal 注册表通过
This commit is contained in:
2026-10-16 15:38:20 +08:00
parent 100f235e3f
commit 327b080b02
44 changed files with 14642 additions and 24 deletions

View File

@@ -64,8 +64,13 @@ stages.forEach((st, si) => {
const title = plain(h2[1].replace(/<span class="n">\d+<\/span>/, ""));
const sections = [...html.matchAll(/<h3 id="([^"]+)">([\s\S]*?)<\/h3>/g)]
.map(x => ({ id: x[1], label: stripNo(plain(x[2])) }));
// 字数口径:只统计中文汉字(代码与英文命令不计入「千字」,否则会被严重高估)
const chars = (stripTags(html).match(/[\u4e00-\u9fff]/g) || []).length;
// 字数口径:只统计中文汉字(代码与英文命令不计入「千字」,否则会被严重高估);
// 侧栏目录树(build-nav.js 写入的整本书目录)与代码块(含中文注释)都不属于正文,先剥掉再数
const prose = html
.replace(/<script[\s\S]*?<\/script>/g, "")
.replace(/<nav id="chapters">[\s\S]*?<\/nav>/g, "")
.replace(/<pre[\s\S]*?<\/pre>/g, "");
const chars = (stripTags(prose).match(/[\u4e00-\u9fff]/g) || []).length;
return { file, title, sections, chars };
});
}