VOOZH about

URL: https://en.wikipedia.org/wiki/Module:Error

⇱ Module:Error - Wikipedia


Jump to content
From Wikipedia, the free encyclopedia
👁 Image
Module documentation
[view] [edit] [history] [purge]
👁 Warning
This Lua module is used on approximately 52,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them.
👁 Image
This module is rated as ready for general use. It has reached a mature state, is considered relatively stable and bug-free, and may be used wherever appropriate. It can be mentioned on help pages and other Wikipedia resources as an option for new users. To minimise server load and avoid disruptive output, improvements should be developed through sandbox testing rather than repeated trial-and-error editing.
👁 Page template-protected
This module is currently protected from editing.
See the protection policy and protection log for more details. Please discuss any changes on the talk page; you may submit an edit request to ask an administrator to make an edit if it is uncontroversial or supported by consensus. You may also request that this page be unprotected.

This module implements {{Error}}. It creates an html message with class "error". Please, see the documentation page there for usage instructions.

See also

-- This module implements {{error}}.
localp={}
functionp._error(args)
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.
returntostring(mw.html.create(tag)
:addClass('error')
:cssText(args.style)
:wikitext(tostring(args.messageorargs[1]orerror('no message specified',2)))
)
end
functionp.error(frame)
localargs
iftype(frame.args)=='table'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
returnp._error(args)
end
returnp