fix(kubernetes): 知识地图的章节清单改为 auto 生成,不再残留「待写」
This commit is contained in:
@@ -161,6 +161,15 @@ function cards() {
|
||||
}).join("\n");
|
||||
}
|
||||
|
||||
function stageMap(id) {
|
||||
return chapters.filter(c => c.stage === id).map(c => {
|
||||
const label = esc(c.short || c.title.split(":")[0]);
|
||||
return c.exists
|
||||
? ` <a href="${c.file}">${c.num} ${label}</a>`
|
||||
: ` <a href="${c.file}" class="todo">${c.num} ${label}</a>`;
|
||||
}).join("\n");
|
||||
}
|
||||
|
||||
/* ---------------------------- 3. 写回 ---------------------------- */
|
||||
const Z = (re, gen, only) => ({ re, gen, only });
|
||||
|
||||
@@ -190,6 +199,9 @@ if (fs.existsSync(path.join(root, "index.html"))) {
|
||||
for (const t of targets) {
|
||||
const p = path.join(root, t.file);
|
||||
let html = fs.readFileSync(p, "utf8");
|
||||
html = html.replace(/<div class="lk" data-auto="(S\d)">[\s\S]*?<\/div>/g,
|
||||
(m, id) => `<div class="lk" data-auto="${id}">\n${stageMap(id)}\n </div>`);
|
||||
|
||||
for (const z of zones) {
|
||||
if (z.only === "index" && !t.idx) continue;
|
||||
if (z.only === "chapter" && t.idx) continue;
|
||||
|
||||
Reference in New Issue
Block a user