feat(go): 面试题库并入学习站,新增第 22 章并顺延速查为第 23 章
- 新增 22-interview-bank.html:289 题 / 25 模块,搜索、模块筛选、展开收起与掌握度标记 - 题库数据迁到 assets/interview-bank-data.js,渲染与样式拆为 interview-bank.js / .css(选择器收在 #bank 下) - 速查章顺延为 23-cheatsheet.html;build-nav 的页脚/侧栏改为动态取末章,新增 side-foot 生成 - 21.5 改为指向站内第 22 章(七天节奏表移入 22.2,避免两处维护) - index / 02-roadmap / part-4 / part-5 / README 的章号、计数与目录树同步(6 篇 23 章 120 小节 124 段 12.2 万字) - 门户删除独立题库入口,project 板块只留一个学习站入口 - 删除 interview/ 与旧 22-cheatsheet.html;check-pages 严格模式与 check-portal 均通过
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
本站分三级页面:
|
||||
目录页 index.html 学习地图 + 六个篇章入口卡片
|
||||
篇章页 part-N.html 一篇的导语 + 该篇的章节卡片(六个篇)
|
||||
章节页 NN-slug.html 一章正文(二十二章)
|
||||
章节页 NN-slug.html 一章正文(二十三章)
|
||||
|
||||
数据来源:
|
||||
tools/outline.json ← 篇 / 章 / 小节 的声明(骨架的唯一来源)
|
||||
@@ -25,6 +25,7 @@
|
||||
<!-- AUTO:prog --> 总体已读进度条
|
||||
<nav class="pager"> 「开始阅读」
|
||||
页脚: <p class="foot"> 三种页面各自的页脚
|
||||
所有页面:<div class="side-foot"> 侧栏底部入口(学习地图 / 末章速查与自测)
|
||||
|
||||
写正文时只写 <article> 里的内容,骨架由本脚本统一生成;调整大纲先改 outline.json
|
||||
与页面标题,再执行本脚本。幂等、可重复运行。
|
||||
@@ -46,6 +47,8 @@ const decode = (s) => s.replace(/</g, "<").replace(/>/g, ">").replace(/&qu
|
||||
.replace(/'/g, "'").replace(/ /g, " ").replace(/&/g, "&");
|
||||
const plain = (s) => decode(stripTags(s));
|
||||
const shortPart = (name) => name.split("·")[0].trim();
|
||||
/* 页脚与侧栏底部要放「末章」入口,标题太长,取冒号前那一段 */
|
||||
const shortTitle = (title) => title.split(":")[0].trim();
|
||||
|
||||
/* ---------------------------- 1. 采集与核对 ---------------------------- */
|
||||
const chapters = [];
|
||||
@@ -217,9 +220,19 @@ function foot(ctx) {
|
||||
`${ctx.part.chapters.reduce((n, c) => n + c.sections.length, 0)} 个小节`;
|
||||
}
|
||||
const c = ctx.chapter;
|
||||
const last = chapters[chapters.length - 1];
|
||||
return ` ${esc(S.name)} · 第 ${c.num} 章 ${esc(c.title)}<br>\n` +
|
||||
` <a href="index.html">学习地图</a> · <a href="${PART_PAGE(c.part.no)}">篇 ${c.part.no} ${esc(shortPart(c.part.name))}</a>` +
|
||||
` · <a href="22-cheatsheet.html">速查与自测</a>`;
|
||||
` · <a href="${last.file}">${esc(shortTitle(last.title))}</a>`;
|
||||
}
|
||||
|
||||
/* 侧栏底部两个快捷入口:回学习地图、跳到末章(速查与自测) */
|
||||
function sidefoot() {
|
||||
const last = chapters[chapters.length - 1];
|
||||
return ` <div class="side-foot">
|
||||
<a class="btn" href="index.html">← 学习地图</a>
|
||||
<a class="btn" href="${last.file}">${esc(shortTitle(last.title))}</a>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
function kpis() {
|
||||
@@ -318,6 +331,7 @@ const zones = [
|
||||
Z(/<!-- AUTO:prog -->[\s\S]*?<!-- \/AUTO:prog -->/, (ctx) => prog(ctx.kind === "index"
|
||||
? allNums : ctx.part.chapters.map((c) => c.num).join(",")), "index|part"),
|
||||
Z(/<nav class="pager">[\s\S]*?<\/nav>/, (ctx) => `<nav class="pager">\n${pager(ctx)}\n </nav>`),
|
||||
Z(/<div class="side-foot">[\s\S]*?<\/div>/, () => sidefoot()),
|
||||
Z(/<p class="foot">[\s\S]*?<\/p>/, (ctx) => `<p class="foot">\n${foot(ctx)}\n </p>`)
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user