Jump to content

Module:Articles by class

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by MSGJ (talk | contribs) at 17:44, 19 December 2024 (check which categories exist). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

require('strict')
local p = {}
local classes = {'FA', 'A', 'GA', 'B', 'C', 'Start', 'Stub', 'FL', 'AL', 'BL', 'CL', 'List', 'SIA', 'Future', 'Category', 'Disambig', 'Draft', 'FM', 'File', 'Needed', 'Portal', 'Project', 'Redirect', 'Template', 'User', 'NA'}

p.main = function(frame)
	local args = require('Module:Arguments').getArgs(frame)
	local title = args.page and mw.title.new(page) or mw.title.getCurrentTitle()
	local class, topic, typ = title.text:match('^(%a+)-Class (%a+) (%a+)$')
	local exist = {}
	for _, class in ipairs(classes) do
		local cat = mw.title.new(class .. '-Class' .. topic .. typ)
		if cat.exists then
			exist[class] = true
		end
	end
end

return p