Module:Lua banner: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Putting that logic in the correct place
(Add parameter to disable protection level tracking, useful when a template only includes part of a module)
(Putting that logic in the correct place)
Line 74:
if titleObj.namespace == 10
and not subpageBlacklist[titleObj.subpageText]
and not args.noprotcat
then
local category = args.category
Line 89 ⟶ 88:
end
cats[#cats + 1] = category
andif not args.noprotcat then
local protLevels = {
autoconfirmedlocal protLevels = 1,{
extendedconfirmed autoconfirmed = 21,
templateeditor extendedconfirmed = 32,
sysop templateeditor = 43,
sysop = 4
}
local currentProt
if titleObj.id ~= 0 then
-- id is 0 (page does not exist) if am previewing before creating a template.
currentProt = titleObj.protectionLevels["edit"][1]
end
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end
for i, module in ipairs(modules) do
local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if local moduleProt == nil then moduleProt = 0 else moduleProt = protLevelsmw.title.new(module).protectionLevels[moduleProt"edit"][1] end
if moduleProt <== currentProtnil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end
if moduleProt < currentProt then
cats[#cats + 1] = "Templates using under-protected Lua modules"
break
end
end
end
end
 
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
0

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu