Elffuss BraidHub

kikocis/utopia public

A citation list is a block, not a heading (#206)

Strip the rendered reference list by its container instead of keying on a References heading. One snapshot renders its citations mid-article and kept 93 of them; a full 214-snapshot rebuild now leaves none.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Changesetb89a499ca65bd8beb765a95658d7ae07092db90b8e4a05c9606953a268937d57
AuthorWaylandYang <145302500+WaylandYang@users.noreply.github.com> · 2026-09-03 03:34 +08:00
CommitterGitHub <noreply@github.com> · 2026-09-03 03:34 +08:00
Parents49653d3b6889

Browse the files at this changeset

1 file changed

modified scripts/bench/fetch-wiki-history.mjs +11 −0
@@ -225,6 +225,17 @@
225225 .replace(/<style[\s\S]*?<\/style>/gi, "")
226226 .replace(/<script[\s\S]*?<\/script>/gi, "")
227227 .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, "")
228239 .replace(/<sup class="reference"[\s\S]*?<\/sup>/gi, "") // 脚注角标
229240 .replace(/<span class="mw-editsection"[\s\S]*?<\/span>/gi, "")
230241 .replace(/<h([1-6])[^>]*>/gi, (_, n) => "\n\n" + "=".repeat(+n) + " ")