Jump to content

Module:Protection banner: Difference between revisions

add some more blurb parameter functions
Enwikipedia>Mr. Stradivarius
(move the parameter functions to the top level of the blurb class and add a new one)
Enwikipedia>Mr. Stradivarius
(add some more blurb parameter functions)
Line 47:
self._expiry = args.expiry or 'indef'
self._section = args.section
if self._protectionDate then= args.date
self._username = args.user
end
 
Line 67 ⟶ 69:
function ProtectionStatus:getSection()
return self._section
end
 
function ProtectionStatus:getProtectionDate()
return self._protectionDate
end
 
function ProtectionStatus:getUsername()
return self._username
end
 
Line 167 ⟶ 177:
 
parameterFuncs[9] = function ()
return self:_makeDisputeLinkParameter() -- A link to the page history or the move log
return self:_makeDisputeLinkParameter()
end
 
Line 187 ⟶ 198:
 
parameterFuncs[14] = function ()
return self:_makeSubjectPageLinksParameter() -- Adds links to edit requests and the talk page if we are on a subject page
-- subject page
return self:_makeSubjectPageLinksParameter()
end
 
Line 259 ⟶ 272:
function Blurb:_makeProtectionDateParameter()
-- parameter $5
local protectionDate = self._protectionStatusObj:getProtectionDate()
if self._protectionDate then
if protectionDate then
local lang = mw.language.getContentLanguage()
local success, date = pcall(
Line 265 ⟶ 279:
lang,
'j F Y',
protectionDate
self._protectionDate
)
if success and date then
Line 271 ⟶ 285:
end
end
end
 
function Blurb:_makeVandalTemplateParameter()
local mVandalM = require('Module:Vandal-m')
local username = self._protectionStatusObj:getUsername()
username = username or self._titleObj.baseText
return mVandalM.luaMain{username}
end
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.