初始化仓库

初始化仓库
This commit is contained in:
2026-09-09 13:19:09 +08:00
parent 484d3877aa
commit d36050cff7
3289 changed files with 499918 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
const fs = require('fs');
const path = require('path');
const dir = 'templates';
const files = fs.readdirSync(dir).filter((f) => f.endsWith('.html'));
for (const f of files) {
const p = path.join(dir, f);
let c = fs.readFileSync(p, 'utf8');
const before = c;
// 1. theme.config.X. → theme.config.X?. (分组级安全导航,防止分组为 null 时 NPE)
c = c.replace(/theme\.config\.([a-z_]+)\./g, 'theme.config.$1?.');
// 2. nav_use_guide / nav_dev_guide 的 th:href 兜底,避免 @{null}
c = c.replace(
/\$\{theme\.config\.nav\?\.nav_use_guide\}/g,
"${theme.config.nav?.nav_use_guide ?: '/'}"
);
c = c.replace(
/\$\{theme\.config\.nav\?\.nav_dev_guide\}/g,
"${theme.config.nav?.nav_dev_guide ?: '/'}"
);
if (c !== before) {
fs.writeFileSync(p, c);
console.log('✓', f);
}
}
console.log('done');