Module:Lua banner: Difference between revisions
m
1 revision imported from wikipedia:Module:Lua_banner
(Add parameter to disable protection level tracking, useful when a template only includes part of a module) |
m (1 revision imported from wikipedia:Module:Lua_banner) |
||
(11 intermediate revisions by 7 users not shown) | |||
Line 34:
for i, module in ipairs(modules) do
moduleLinks[i] = string.format('[[:%s]]', module)
if maybeSandbox.exists then
moduleLinks[i] = moduleLinks[i] .. string.format(' ([[:%s|sandbox]])', maybeSandbox.fullText)
end
local moduleList = mList.makeList('bulleted', moduleLinks)
Line 48 ⟶ 52:
boxArgs.type = 'notice'
boxArgs.small = true
boxArgs.image = '[[File:Lua-
return mMessageBox.main('mbox', boxArgs)
end
Line 72 ⟶ 76:
testcases = true
}
if not subpageBlacklist[titleObj.
local protCatName
if titleObj.namespace == 10 then
and not args.noprotcat▼
local category = args.category
local categories = {▼
['Module:String'] = 'Templates based on the String Lua module',
▲ local categories = {
['Module:
['Module:
['Module:
['Module:Citation'] = 'Lua-based citation templates'▼
category = modules[1] and categories[modules[1]]▼
▲ }
end
▲ category = modules[1] and categories[modules[1]]
elseif titleObj.namespace == 828 then
protCatName = "Modules depending on under-protected modules"
end
cats[#cats + 1] = category▼
local protLevels = {
autoconfirmed = 1,
extendedconfirmed = 2,
templateeditor = 3,
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
if module ~= "WP:libraryUtil" then
▲ local moduleProt = mw.title.new(module).protectionLevels["edit"][1]
if moduleProt
if moduleProt < currentProt then
▲ cats[#cats + 1] = "Templates using under-protected Lua modules"
▲ break
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
|