Module: Tl

From A Wiki of Ice and Fire
Jump to: navigation, search

Documentation for this module may be created at Module:Tl/doc

local getArgs = require('Module:Arguments').getArgs
local lang = mw.getContentLanguage()

local p = {}

function p.main(frame)
    local args = getArgs(frame)
    local template = args[1]
    local output = '{{[[Template:' .. template .. '|' ..  template .. ']]'
    for key, value in pairs(args) do
        if key ~= 1 then
            value = value or ''
            if lang:parseFormattedNumber(key) == nil then
                output = output .. '|' .. key .. '=' .. value
            else
                output = output .. '|' .. value
            end
        end
    end
    local output = output .. '}}'
    return output
end

return p