Module: Tl: Difference between revisions

From A Wiki of Ice and Fire
Jump to: navigation, search
Abjiklam (talk | contribs)
No edit summary
Abjiklam (talk | contribs)
No edit summary
Line 8: Line 8:
     local output = '{{[[Template:' .. template .. '|' ..  template .. ']]'
     local output = '{{[[Template:' .. template .. '|' ..  template .. ']]'
     for key, value in pairs(args) do
     for key, value in pairs(args) do
         if key ~= 1 and value ~= nil then
         if key ~= 1 then
            output = output .. '|' .. key .. '=' .. value
            value = value or ''
            if lang:parseFormattedNumber(key) == nil then
                output = output .. '|' .. key .. '=' .. value
            else
                output = output .. '|' .. value
            end
         end
         end
     end
     end

Revision as of 13:39, 5 November 2022

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

local getArgs = require('Module:Arguments').getArgs

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