Module:Protection banner: Difference between revisions

make makeFullUrl a local helper function
(specify Template:Pp as a wrapper for the module, and make args a local variable as otherwise it's a bit of a bracket overload)
(make makeFullUrl a local helper function)
Line 43: Line 43:
tostring(dateString)
tostring(dateString)
))
))
end
local function makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end
end


Line 319: Line 327:


-- Static methods --
-- Static methods --
function Blurb.makeFullUrl(page, query, display)
return string.format(
'[%s %s]',
tostring(mw.uri.fullUrl(page, query)),
display
)
end


function Blurb.formatDate(num)
function Blurb.formatDate(num)
Line 396: Line 396:
if self._protectionObj.action == 'move' then
if self._protectionObj.action == 'move' then
-- We need the move log link.
-- We need the move log link.
return self.makeFullUrl(
return makeFullUrl(
'Special:Log',
'Special:Log',
{type = 'move', page = pagename},
{type = 'move', page = pagename},
Line 403: Line 403:
else
else
-- We need the history link.
-- We need the history link.
return self.makeFullUrl(
return makeFullUrl(
pagename,
pagename,
{action = 'history'},
{action = 'history'},
Line 598: Line 598:
if self._protectionObj.action == 'autoreview' then
if self._protectionObj.action == 'autoreview' then
-- We need the pending changes log.
-- We need the pending changes log.
return self.makeFullUrl(
return makeFullUrl(
'Special:Log',
'Special:Log',
{type = 'stable', page = pagename},
{type = 'stable', page = pagename},
Line 605: Line 605:
else
else
-- We need the protection log.
-- We need the protection log.
return self.makeFullUrl(
return makeFullUrl(
'Special:Log',
'Special:Log',
{type = 'protect', page = pagename},
{type = 'protect', page = pagename},
Anonymous user