Changes

Jump to navigation Jump to search

Module:Protection banner

534 bytes removed, 03:20, 3 October 2014
use actual Lua errors, and a small fix to parameter handling
dateType,
tostring(dateString)
), 04)
end
'invalid action ("%s")',
tostring(args.action)
), 03)
end
obj.reason = mw.ustring.lower(args[1])
if obj.reason:find('|') then
error('reasons cannot contain the pipe character ("|")', 03)
end
end
level,
talkKey
), 8)
end
return self:_substituteParameters(msg)
return pagetypes[self._protectionObj.title.namespace]
or pagetypes.default
or error('no default pagetype defined', 8)
end
msg = protectionBlurbs.edit.default
else
error('no protection blurb defined for protectionBlurbs.edit.default', 8)
end
return self:_substituteParameters(msg)
msg = protectionLevels.edit.default
else
error('no protection level defined for protectionLevels.edit.default', 8)
end
return self:_substituteParameters(msg)
tostring(key),
type(msg)
), 4)
end
return self:_substituteParameters(msg)
-- Renders the banner.
makeMessageBox = makeMessageBox or require('Module:Message box').main
local reasonText = self._reasonText or error('no reason text set', 2)
local explanationText = self._explanationText
local mbargs = {
cfg = cfg or require(CONFIG_MODULE)
-- Initialise the protection object and check for errors local protectionObjCreated, protectionObj = pcall( Protection.new, (args, cfg, title ) if not protectionObjCreated then local errorBlurb = cfg.msg['error-message-blurb'] or 'Error: $1.' local errorText = mw.message.newRawMessage(errorBlurb) :params(protectionObj) -- protectionObj is the error message :plain() return string.format( '<strong class="error">%s</strong>%s', errorText, makeCategoryLink( cfg.msg['tracking-category-incorrect'], title and title.text or mw.title.getCurrentTitle().text ) ) end
local ret = {}
-- Find default args, if any.
local parent = frame.getParent and frame:getParent()
local defaultArgs = parent and cfg.wrappers[parent:getTitle():gsub('/sandbox$', '')] or {}
-- Find user args, and use the parent frame if we are being called from a
-- Build the args table. User-specified args overwrite default args.
local args = {}
for k, v in pairs(defaultArgsor {}) do
args[k] = v
end
Anonymous user

Navigation menu