模块:ExpTmplAtk

来自希服维基

可在模块:ExpTmplAtk/doc创建此模块的帮助文档

local p = {}
function p.test(frame)
    local parent = frame:getParent()
    if not parent or not parent.expandTemplate then return "no_expandTemplate" end

    local results = {}

    -- Try to expand a template with dangerous parameters
    -- Template: could be a redirect, an invoke, etc.
    local templates = {
        {"TestScribuntoFrame", {}},
        {"TestFrameChain", {}},
    }

    for _, tmpl in ipairs(templates) do
        local ok, out = pcall(parent.expandTemplate, parent, {title = tmpl[1], args = tmpl[2]})
        results[#results+1] = tmpl[1]:sub(1,30) .. "=" .. tostring(ok) .. ":" .. tostring(out):sub(1,40)
    end

    return table.concat(results, " | ")
end
return p