Module:Check aliases

From para.wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Check aliases/doc

local p = {}

function p.exec(frame)
	args = frame.args
	local first = tonumber(args.first) or 1
	local last = tonumber(args.last) or 999
	local sep = args.sep or "%s*,%s*"
	local it = mw.text.gsplit(args[1], sep)
	
	local i = 1
	while i < first do
		i = i + 1
		it()
	end
	
	for alias in it do
		if i > last then break end
		i = i + 1
		if not mw.title.new(alias).exists then
			return "[[Category:Articles missing alias pages]]"
		end
	end
end

return p