Open main menu

Changes

Module:Protection banner

259 bytes added, 16:17, 8 June 2014
export classes for testing purposes and a few other tweaks
function Config:getConfigTable(key)
local whitelisted blacklist = { images banners = true, categories = true, categoryNamespaces = true, pagetypeNamespaces = true, errorCategories defaultBanners = true
}
if whitelistednot blacklist[key] then
return self._cfg[key]
else
local ProtectionBanner = {}
function ProtectionBanner._newBannerTemplate(args) -- Makes a new banner template object. This will be a new instance of -- the most suitable subclass of BannerTemplate, e.g. Banner or Padlock. if yesno(args.small) then return Padlock:new(args) else return Banner:new(args) endend function ProtectionBanner.exportToWiki(frame, titleObjtitle)
local args = mArguments.getArgs(frame)
return ProtectionBanner.exportToLua(args, titleObjtitle)
end
function ProtectionBanner.exportToLua(args, title)
title = title or mw.title.getCurrentTitle()
local pstatus = ProtectionStatus.new(args, title)
local cfg = Config:new()
 
-- Get the banner template object
local banner
do
local bannerClass
if yesno(args.small) then
bannerClass = Padlock
else
bannerClass = Banner
end
banner = bannerClass:new()
end
end
 
function ProtectionBanner._exportClasses()
return {
ProtectionStatus = ProtectionStatus,
Config = Config,
Image = Image,
Blurb = Blurb,
BannerTemplate = BannerTemplate,
Banner = Banner,
Padlock = Padlock,
Category = Category,
ProtectionCategory = ProtectionCategory,
ErrorCategory = ErrorCategory,
ExpiryCategory = ExpiryCategory
}
end
return ProtectionBanner
Anonymous user