feat: 第 13-16 章正文(Skill 机制 / HTTP 接口层 / 前端 / 基础设施与部署)
This commit is contained in:
17
project/ai-agent-scafford-go/tools/_tmp_ent.js
Normal file
17
project/ai-agent-scafford-go/tools/_tmp_ent.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const fs = require('fs');
|
||||
const p = '15-frontend.html';
|
||||
let h = fs.readFileSync(p, 'utf8');
|
||||
|
||||
// 1) 全文件:数字实体 -> 命名实体
|
||||
h = h.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');
|
||||
|
||||
// 2) 代码块内:补齐 & 与 > 的转义(< 已全部处理)
|
||||
h = h.replace(/<pre([^>]*)>([\s\S]*?)<\/pre>/g, (m, attrs, body) => {
|
||||
let b = body;
|
||||
b = b.replace(/&(?!(amp|lt|gt|quot|#\d+);)/g, '&');
|
||||
b = b.replace(/>/g, '>');
|
||||
return `<pre${attrs}>${b}</pre>`;
|
||||
});
|
||||
|
||||
fs.writeFileSync(p, h);
|
||||
console.log('done, bytes', h.length);
|
||||
Reference in New Issue
Block a user