Anonymous user
Module:Protection banner: Difference between revisions
use gsub instead of the mw.message library for substituting parameters, as mw.message:params doesn't work with metatables; also, a few bug fixes
Enwikipedia>Mr. Stradivarius (remove the Image class from _exportClasses) |
Enwikipedia>Mr. Stradivarius (use gsub instead of the mw.message library for substituting parameters, as mw.message:params doesn't work with metatables; also, a few bug fixes) |
||
Line 76:
function Config:initialize()
self._cfg = data.cfg
self._msg = data.msg
end
Line 103 ⟶ 105:
function Config:getMessage(key)
return self.
end
Line 172 ⟶ 174:
self._params = params
end
local function getParameter(match)
match = tonumber(match)
return self._params[match]
end
msg = msg:gsub('$([1-9][0-9]*)', getParameter)
return msg
end
Line 224 ⟶ 233:
function Blurb:_makePagetypeParameter()
-- parameter $4
local pagetypes = self._configObj:getConfigTable('
local namespace = self._titleObj
return pagetypes[namespace] or pagetypes.default or 'page'
end
Line 419 ⟶ 428:
self._configObj:getMessage('deletion-log-link-display')
)
end
function Blurb:makeReasonText()
local msg = self._bannerConfig.text
return self:_substituteParameters(msg)
end
|