Jump to content

Module:Year category type

Ón Vicipéid, an chiclipéid shaor.

Documentation for this module may be created at Module:Year category type/doc

local p = {}

local units = {
	year = "^%d*$",
	year_bc = "^%d* RC$",
	year_ad = "^AD %d*$",
	decade = "^%d*0idí$",
	decade_bc = "^%d*0idí RC$",
	century = "^%d*ú.haois$",
	century_bc = "^%d*ú.haois RC$",
	millennium = "^%d*ú.millennium$",
	millennium_bc = "^%d*ú.millennium RC$",
}

function p.main(frame)
	local title = mw.title.getCurrentTitle().text

	for unit, pattern in pairs(units) do
		if string.match(title, pattern) then
			return unit
		end
	end

	return -1
end

return p