Module:Protection banner: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
(finish converting p.getCategoryName) |
(make some image tweaks and start a function for substituting blurb parameters) |
||
Line 144: | Line 144: | ||
image = images.pc2 |
image = images.pc2 |
||
end |
end |
||
else |
|||
image = 'Transparent.gif' |
|||
end |
end |
||
self._filename = image |
self._filename = image |
||
Line 152: | Line 150: | ||
function Image:export() |
function Image:export() |
||
return mFileLink.new(self._filename) |
return mFileLink.new(self._filename or 'Transparent.gif') |
||
:width(self._size) |
:width(self._size or 20) |
||
:alt(self._alt) |
:alt(self._alt) |
||
:link(self._link) |
|||
:caption(self._caption) |
:caption(self._caption) |
||
:render() |
:render() |
||
Line 167: | Line 166: | ||
function Blurb:initialize(bannerConfig) |
function Blurb:initialize(bannerConfig) |
||
self._config = bannerConfig |
self._config = bannerConfig |
||
end |
|||
function Blurb:_substituteParameters(msg, configObj) |
|||
if not self._params then |
|||
local params, parameterFuncs = {}, {} |
|||
setmetatable(params, { |
|||
__index = function (t, k) |
|||
local param |
|||
if parameterFuncs[k] then |
|||
param = parameterFuncs[k]() |
|||
end |
|||
params[k] = param |
|||
return param |
|||
end |
|||
}) |
|||
parameterFuncs[1] = function () |
|||
return 'This page is currently [[Help:Protection|protected]] from editing' |
|||
end |
|||
-- TODO: Write parameter functions |
|||
self._params = params |
|||
end |
|||
return mw.message.newRawMessage(msg):params(self._params):plain() |
|||
end |
end |
||