模块:Tmpl

来自有兽档案馆
文档图示 模块文档[创建] [跳转到代码]

本模块还没有文档页面。

您可以创建文档以让编者更好地理解本模块的用途。
编者可以在本模块的沙盒创建 | 镜像和测试样例创建页面进行实验。
请将模块自身所属的分类添加在文档中。本模块的子页面
-- This is a helper module for Template:tmpl
local this = {}

function this.renderTmpl(frame)
    local args = frame.args
    local pargs = (frame:getParent() or {}).args
    local result = pargs[0] or ''
    for k, v in pairs(pargs) do
        local n = tonumber(k) or -1
        if (n >= 1 and n <= 9) then
            result = mw.ustring.gsub( result, '$' .. n, mw.text.trim(v) )
        end
    end
    return result
end

return this