2,342
edits
(Add parameter to disable protection level tracking, useful when a template only includes part of a module) |
m (1 revision imported) |
||
Line 1: | Line 1: | ||
-- This module implements the {{lua}} template. | -- This module implements the {{lua}} template. | ||
local yesno = require('Module:Yesno') | local yesno = require('Module:Yesno') | ||
local mList = require('Module:List') | local mList = require('Module:List') | ||
Line 36: | Line 37: | ||
end | end | ||
local moduleList = mList.makeList('bulleted', moduleLinks) | local moduleList = mList.makeList('bulleted', moduleLinks) | ||
boxArgs.text = 'Uses [[Wikipedia:Lua|Lua]]:\n' .. moduleList | |||
end | end | ||
boxArgs.type = 'notice' | boxArgs.type = 'notice' | ||
boxArgs.small = true | boxArgs.small = true | ||
boxArgs.image = '[[File:Lua-logo-nolabel.svg|30px|alt=|link=]]' | boxArgs.image = '[[File:Lua-logo-nolabel.svg|30px|alt=Lua logo|link=Wikipedia:Lua]]' | ||
return mMessageBox.main('mbox', boxArgs) | return mMessageBox.main('mbox', boxArgs) | ||
end | end | ||
Line 56: | Line 49: | ||
return '' | return '' | ||
end | end | ||
local cats = {} | local cats = {} | ||
-- Error category | -- Error category | ||
if #modules < 1 then | if #modules < 1 then | ||
cats[#cats + 1] = 'Lua templates with errors' | cats[#cats + 1] = 'Lua templates with errors' | ||
end | end | ||
-- Lua templates category | -- Lua templates category | ||
titleObj = titleObj or mw.title.getCurrentTitle() | titleObj = titleObj or mw.title.getCurrentTitle() | ||
Line 72: | Line 65: | ||
testcases = true | testcases = true | ||
} | } | ||
if titleObj.namespace == 10 | if titleObj.namespace == 10 | ||
and not subpageBlacklist[titleObj.subpageText] | and not subpageBlacklist[titleObj.subpageText] | ||
then | then | ||
local category = args.category | local category = args.category | ||
Line 89: | Line 81: | ||
end | end | ||
cats[#cats + 1] = category | cats[#cats + 1] = category | ||
end | end | ||
for i, cat in ipairs(cats) do | for i, cat in ipairs(cats) do | ||
cats[i] = string.format('[[Category:%s]]', cat) | cats[i] = string.format('[[Category:%s]]', cat) |