Idi na sadržaj

Modul:Error

S Wikipedije, slobodne enciklopedije
Dokumentacija modula[uredi] [historija] [osvježi keš]
Ova dokumentacija je prikazana uModul:Error/dok.

Ova modula izbacuje HTML poruku koja nosi klasu "error". Zamjenjuje šablon {{error}} - za više informacija pogledati dokumentaciju ovog šablona.


-- This module implements {{error}}.

localp={}

localHtmlBuilder=require('Module:HtmlBuilder')

localfunction_error(args)
localmessage=args.messageorargs[1]orerror('poruka nije navedena',2)
message=tostring(message)
localtag=mw.ustring.lower(tostring(args.tag))

-- Work out what html tag we should use.
ifnot(tag=='p'ortag=='span'ortag=='div')then
tag='strong'
end

-- Generate the html.
localroot=HtmlBuilder.create(tag)
root
.addClass('error')
.wikitext(message)

returntostring(root)
end

functionp.error(frame)
localargs
ifframe==mw.getCurrentFrame()then
-- We're being called via #invoke. The args are passed through to the module
-- from the template page, so use the args that were passed into the template.
args=frame.args
else
-- We're being called from another module or from the debug console, so assume
-- the args are passed in directly.
args=frame
end
-- if the message parameter is present but blank, change it to nil so that Lua will
-- consider it false.
ifargs.message==""then
args.message=nil
end
return_error(args)
end

returnp