Anonymous user
Module:Lua banner: Difference between revisions
show link to module sandbox, requested by User:Andrybak
imported>Pppery (Add parameter to disable protection level tracking, useful when a template only includes part of a module) |
en>MSGJ (show link to module sandbox, requested by User:Andrybak) |
||
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 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 = {▼
▲ local categories = {
['Module:
['Module:
['Module:
▲ ['Module:Citation'] = 'Lua-based citation templates'
categories['Module:Citation/CS1'] = categories['Module:Citation']
▲ }
category =
end
cats[#cats + 1] = category▼
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"
cats[#cats + 1] = protCatName
▲ break
break
end
end
end
end
end
for i, cat in ipairs(cats) do
cats[i] = string.format('[[Category:%s]]', cat)
|