--[[-- 知乎章末排版:备案号清理、缓存升级、正文坐标与失败时的原文件保护。 @module tests.moonsource_zhihu.content_layout_spec --]] local Assert = require("support.assert") local Config = require("support.config") local Content = require("moonsource_zhihu.content") local Fs = require("utils.fs") local prefix = '
正文里的备案号说明不能删。
' local watermark = '备美号:YXXBfixture' local raw = prefix .. "" .. watermark .. "
" local html = Content.prepare(raw) Assert.is_true(html:find(prefix, 1, true) ~= nil, "前面的原文节点和属性逐字保留") Assert.is_nil(html:find("vipyxcode", 1, true)) Assert.is_nil(html:find("YXXBfixture", 1, true), "按稳定的元素 id 清理,不依赖可能被字体扰乱的文字") Assert.is_true(html:find("", 1, true) ~= nil, "保留空段落,不挪动其它节点编号") Assert.is_true(html:find(Content.FOOTER .. "