Modul:Protection banner: Unterschied zwischen den Versionen
export classes for testing purposes and a few other tweaks
(add no globals now, to catch any problems sooner rather than later) |
(export classes for testing purposes and a few other tweaks) |
||
Zeile 88: | Zeile 88: | ||
function Config:getConfigTable(key) | function Config:getConfigTable(key) | ||
local | local blacklist = { | ||
banners = true, | |||
defaultBanners = true | |||
} | } | ||
if | if not blacklist[key] then | ||
return self._cfg[key] | return self._cfg[key] | ||
else | else | ||
Zeile 187: | Zeile 184: | ||
local ProtectionBanner = {} | local ProtectionBanner = {} | ||
function ProtectionBanner.exportToWiki(frame, title) | |||
function ProtectionBanner.exportToWiki(frame, | |||
local args = mArguments.getArgs(frame) | local args = mArguments.getArgs(frame) | ||
return ProtectionBanner.exportToLua(args, | return ProtectionBanner.exportToLua(args, title) | ||
end | end | ||
function ProtectionBanner.exportToLua(args, title) | function ProtectionBanner.exportToLua(args, title) | ||
title = title or mw.title.getCurrentTitle() | 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 | end | ||
return ProtectionBanner | return ProtectionBanner |