Changesets · Branches · Tags · Compare
| Changeset | b89a499ca65bd8beb765a95658d7ae07092db90b8e4a05c9606953a268937d57 |
|---|---|
| Author | WaylandYang <145302500+WaylandYang@users.noreply.github.com> · 2026-09-03 03:34 +08:00 |
| Committer | GitHub <noreply@github.com> · 2026-09-03 03:34 +08:00 |
| Parents | 49653d3b6889 |
1 file changed
modified scripts/bench/fetch-wiki-history.mjs +11 −0
| @@ -225,6 +225,17 @@ | ||
| 225 | 225 | .replace(/<style[\s\S]*?<\/style>/gi, "") |
| 226 | 226 | .replace(/<script[\s\S]*?<\/script>/gi, "") |
| 227 | 227 | .replace(/<table[\s\S]*?<\/table>/gi, "") // 信息框/导航框:全是模板残渣 |
| 228 | + // **引文列表按结构切,不按标题切。** `CUT` 认的是 `== References ==` 那行, | |
| 229 | + // 而参考文献是渲染出来的一个块,它**不一定在那个标题下面**:`<references/>` | |
| 230 | + // 写在哪一节,它就渲染在哪一节。实测 216 张快照里有一张如此 | |
| 231 | + //(`Mistral AI` @2024-12-10,refs 块落在 Recent Developments 里), | |
| 232 | + // 于是标题切完了,93 条引文照样留在正文里——占那一版正文的三分之一, | |
| 233 | + // 而它们正是 `Wired --employee--> Steven Levy` 那类假事实的来源。 | |
| 234 | + // | |
| 235 | + // 容器名是 MediaWiki 渲染的,不是条目作者写的,所以它比标题文字稳 | |
| 236 | + // (标题可以被译、被改写、被写成 `== Notes and references ==`)。 | |
| 237 | + // 标题那条留着:它还管着 External links / See also 这些不该进语料的尾节 | |
| 238 | + .replace(/<ol class="references"[\s\S]*?<\/ol>/gi, "") | |
| 228 | 239 | .replace(/<sup class="reference"[\s\S]*?<\/sup>/gi, "") // 脚注角标 |
| 229 | 240 | .replace(/<span class="mw-editsection"[\s\S]*?<\/span>/gi, "") |
| 230 | 241 | .replace(/<h([1-6])[^>]*>/gi, (_, n) => "\n\n" + "=".repeat(+n) + " ") |