Editing Module:Lua banner
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
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 34: | Line 35: | ||
for i, module in ipairs(modules) do | for i, module in ipairs(modules) do | ||
moduleLinks[i] = string.format('[[:%s]]', module) | moduleLinks[i] = string.format('[[:%s]]', module) | ||
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 60: | 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() | local titleObj = titleObj or mw.title.getCurrentTitle() | ||
local subpageBlacklist = { | local subpageBlacklist = { | ||
doc = true, | doc = true, | ||
Line 76: | Line 65: | ||
testcases = true | testcases = true | ||
} | } | ||
if not subpageBlacklist[titleObj.subpageText] then | if titleObj.namespace == 10 | ||
and not subpageBlacklist[titleObj.subpageText] | |||
then | |||
local category = args.category | |||
if not category then | |||
local categories = { | |||
['Module:String'] = 'Lua String-based templates', | |||
['Module:Math'] = 'Templates based on the Math Lua module', | |||
['Module:BaseConvert'] = 'Templates based on the BaseConvert Lua module', | |||
['Module:Citation'] = 'Lua-based citation templates' | |||
} | } | ||
categories['Module:Citation/CS1'] = categories['Module:Citation'] | |||
category = modules[1] and categories[modules[1]] | |||
category = category or 'Lua-based templates' | |||
end | end | ||
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) |