Module:Sandbox
Appearance
local p = {}
function p.test(f) local a = f.args[1]
function c(t) return "<code style=color:red;font-weight:bold;background:lime;border-color:blue;border-radius:.4em>the "..t.."</code>" end
if not a then return c('parameter is unspecified')
elseif a == '' then return c('parameter is empty')
else return c('specified parameter is “'..a..'”') end
end
function p.tl(f)
local a = f.args
if a.tag == '' or not a.tag then tag = 'code' else tag = a.tag end
if a.template == '' or not a.template then n = a[1] else n = a.template end
if f:callParserFunction('ucfirst', n:gsub('_', ' ')) == f:callParserFunction('PAGENAME', n) then link = 'Template:'..n else link = n end
if a.shl == '1' then
color = ' style=color:#80c'
b = "<b>"
bb = '</b>'
function u(t) return '<u'..color..'>'..t..'</u>' end
function eb(t)
for _, eq in pairs({"=", "=", "=", "="}) do
if t ~= f:callParserFunction('#explode', t, eq) then t = b..f:callParserFunction('#explode', t, eq)..eq..bb..f:callParserFunction('#explode', t, eq, 1, 2) end
end
return t
end
else
color = ''
b = ''
bb = ''
function u(t) return t end
function eb(t) return t end
end
local r = "<"..tag..color..">"..b..'{{[['..link..'|'..u(n)..']]'
for i, v in ipairs(a) do
if i > 2 or i > 1 and a.template == n then r = r..b..'|'..bb elseif i == 2 or i == 1 and a.template == n then r = r..'|'..bb end
if a.template == n or i ~= 1 then r = r..eb(v) end
end
r = r..b..'}}'..bb.."</"..tag..">"
return r
end
return p