This is an old revision of this page, as edited by DePiep(talk | contribs) at 20:53, 4 April 2013(←Created page with '-- This module implements {{error}}. local p = {} local HtmlBuilder = require('Module:HtmlBuilder') local function _error(args) -- sandbox: move arg logic...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.Revision as of 20:53, 4 April 2013 by DePiep(talk | contribs)(←Created page with '-- This module implements {{error}}. local p = {} local HtmlBuilder = require('Module:HtmlBuilder') local function _error(args) -- sandbox: move arg logic...')
This module is rated as ready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved by sandbox testing rather than repeated trial-and-error editing.
This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing.
This module implements {{Error}}. It creates an html message with class "error". Please, see the documentation page there for usage instructions.
-- This module implements {{error}}.localp={}localHtmlBuilder=require('Module:HtmlBuilder')localfunction_error(args)-- sandbox: move arg logic together here-- If the message parameter is present but blank, change it to nil so that Lua will-- consider it false.ifargs.message==""thenargs.message=nilend-- sandbox: remove internal error messagelocalmessage=args.messageorargs[1]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')thentag='strong'end-- Generate the html.localroot=HtmlBuilder.create(tag)root.addClass('error').wikitext(message)returntostring(root)endfunctionp.error(frame)localargsifframe==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.argselse-- We're being called from another module or from the debug console, so assume-- the args are passed in directly.args=frameendreturn_error(args)endreturnp