Modul:Protection banner: Unterschied zwischen den Versionen

simplify _substituteParameters
(make makeFullUrl a local helper function)
(simplify _substituteParameters)
Zeile 350: Zeile 350:
function Blurb:_substituteParameters(msg)
function Blurb:_substituteParameters(msg)
if not self._params then
if not self._params then
local params, parameterFuncs = {}, {}
local parameterFuncs = {}
setmetatable(params, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
params[k] = param
return param
end
})


parameterFuncs.CURRENTVERSION    = self._makeCurrentVersionParameter
parameterFuncs.CURRENTVERSION    = self._makeCurrentVersionParameter
Zeile 383: Zeile 372:
parameterFuncs.VANDAL            = self._makeVandalTemplateParameter
parameterFuncs.VANDAL            = self._makeVandalTemplateParameter
self._params = params
self._params = setmetatable({}, {
__index = function (t, k)
local param
if parameterFuncs[k] then
param = parameterFuncs[k](self)
end
param = param or ''
t[k] = param
return param
end
})
end
end
Anonymer Benutzer