Module:Protection banner: Difference between revisions
Content deleted Content added
new structure for the banners table |
make outline of the main function |
||
Line 175:
}
cfg.errorCategories = {
incorrect = 'Wikipedia pages with incorrect protection templates',
create = 'Wikipedia pages tagged as create-protected',
template = 'Wikipedia template-protected pages other than templates and modules'
}
--------------------------------------------------------------------------------
Line 215 ⟶ 212:
function p._main(args)
-- Get the protection level of the title we are working on.
local title▼
local protectionLevel
if args.page then▼
do
title = mw.title.new(args.page)▼
else▼
title = mw.title.getCurrentTitle()▼
▲ title = mw.title.new(args.page)
▲ title = mw.title.getCurrentTitle()
end
protectionLevel = protectionData[args.action or 'edit']
protectionLevel = protectionLevel or '*'
end
▲ local protectionData = p.getProtectionData(title)
-- Generate the banner or padlock output.
local ret = ''
ret = ret .. p.renderBannerOrPadlock(protectionLevel, args)
-- Add protection category
if protectionLevel ~= '*' then
ret = ret .. p.renderProtectionCategory(protectionLevel, args)
end
-- Add tracking categories
ret = ret .. p.renderTrackingCategories(protectionLevel, args)
return ret
end
|