Module: Tl: Difference between revisions

From A Wiki of Ice and Fire
Jump to: navigation, search
Abjiklam (talk | contribs)
Created page with "local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) local args = getArgs(frame) local template = args[1] local output = '&#12..."
 
Abjiklam (talk | contribs)
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs
local lang = mw.getContentLanguage()


local p = {}
local p = {}
Line 8: Line 9:
     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
Line 15: Line 21:
     return output
     return output
end
end
return p

Latest 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 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