Documentation for this module may be created at ମଡ୍ୟୁଲ:Year category type/doc

local p = {}

local units = {
    year = "^[୧୨୩୪୫୬୭୮୯୦]*$",
    year_bc = "^[୧୨୩୪୫୬୭୮୯୦]* BC$",
    year_ad = "^AD [୧୨୩୪୫୬୭୮୯୦]*$",
    decade = "^[୧୨୩୪୫୬୭୮୯୦]* ଦଶକ$",
    decade_bc = "^%d*0s BC$",
    century = "^[୧୨୩୪୫୬୭୮୯୦]*ଶ ଶତାବ୍ଦୀ$",
    century_bc = "^%d*[snrt][tdh].century BC$",
    millennium = "^%d*[snrt][tdh].millennium$",
    millennium_bc = "^%d*[snrt][tdh].millennium BC$",
}

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