Modul:Protection banner: Unterschied zwischen den Versionen

make some image tweaks and start a function for substituting blurb parameters
(finish converting p.getCategoryName)
(make some image tweaks and start a function for substituting blurb parameters)
Zeile 144: Zeile 144:
image = images.pc2
image = images.pc2
end
end
else
image = 'Transparent.gif'
end
end
self._filename = image
self._filename = image
Zeile 152: Zeile 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()
Zeile 167: Zeile 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


Anonymer Benutzer