Módulo:Error: mudanças entre as edições
Aspeto
Criou página com '------------------------------------------------------------------------------- -- -- Module:Error -- -- This module implements Template:Error ------------------------------------------------------------------------------- local cfg = {} cfg.i18n = {} cfg.i18n.errors = { no_message = 'No message specified.', } cfg.tag = 'strong' -- ---------------------------------------------------------------------------- -- Main function -- ---...' |
Sem resumo de edição |
||
Linha 1: | Linha 1: | ||
_pageName='{{#replace:{{PAGENAME}}|'|\'}}' | |||
------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | ||
-- | -- |
Edição atual tal como às 00h25min de 7 de fevereiro de 2025
A documentação para este módulo pode ser criada em Módulo:Error/doc
_pageName='{{#replace:{{PAGENAME}}|'|\'}}'
-------------------------------------------------------------------------------
--
-- Module:Error
--
-- This module implements Template:Error
-------------------------------------------------------------------------------
local cfg = {}
cfg.i18n = {}
cfg.i18n.errors = {
no_message = 'No message specified.',
}
cfg.tag = 'strong'
-- ----------------------------------------------------------------------------
-- Main function
-- ----------------------------------------------------------------------------
local function _main(args)
args.message = args.message or args[1]
if not args.message or args.message == '' then
error(cfg.i18n.errors.no_message, 2)
end
local html = mw.html.create(cfg.tag)
:addClass('error')
:wikitext(tostring(args.message))
return tostring(html)
end
-- ----------------------------------------------------------------------------
-- Exported functions
-- ----------------------------------------------------------------------------
local p = {}
function p.main(frame)
local args
if type(frame.args) == 'table' then
-- Called via #invoke, so use the args that were passed into the
-- template.
args = frame.args
else
-- Called from another module or from the debug console, so assume args
-- are passed in directly.
args = frame
end
return _main(args)
end
p.error = p.main
return p