模块:Deep2 FramePreprocess
可在模块:Deep2 FramePreprocess/doc创建此模块的帮助文档
local p = {}
function p.test()
local frame = mw.getCurrentFrame()
if frame.preprocess then
-- Try preprocessing various content types
local tests = {
{"wikitext", "'''bold'''"},
{"syntaxhighlight", "<syntaxhighlight lang='python'>print(1)</syntaxhighlight>"},
{"math", "<math>\\frac{1}{2}</math>"},
{"invoke", "{{#invoke:Example|hello}}"},
}
local results = {}
for _, t in ipairs(tests) do
local ok, out = pcall(frame.preprocess, t[2])
results[#results+1] = t[1] .. "=" .. tostring(ok) .. ":" .. tostring(out):sub(1,50)
end
return table.concat(results, " | ")
end
return "no_preprocess"
end
return p