Modul:Error/igralište
Dokumentaciju za ovaj modul možete napraviti na stranici Modul:Error/igralište/dok
-- This module implements {{error}}.
local getArgs = require('Module:Arguments').getArgs
local yesno = require('Module:Yesno')
local p = {}
function p.error(frame)
local args = getArgs(frame)
return p._error(args)
end
function p._error(args)
-- Initialise variables
local message = args.message or args[1] or error('no message specified', 2)
local tag = args.tag or ''
local category = args.category
-- Work out what HTML tag we should use
tag = tag:lower()
if not (tag == 'p' or tag == 'span' or tag == 'div') then
tag = 'strong'
end
-- Generate the category
if yesno(category, true) ~= false then
category = '[[Category:Template errors]]'
else
category = ''
end
-- Generate the HTML
local ret = string.format(
'<%s class="error">%s</%s>%s',
tag, message, tag, category
)
return ret
end
return p