Pojdi na vsebino

Modul:Year category type

Iz Wikipedije, proste enciklopedije
local p = {}

local units = {
	year = "^Leto %d*$",
	year_bc = "^Leto %d* pr. n. št.$",
	year_ad = "^Leto %d*$",
	decade = "^%d*0%.*.leta$",
	decade_bc = "^%d*0%.*.leta pr%. n%. št%.$",
	century = "^%d*%..stoletje$",
	century_bc = "^%d*%..stoletje pr%. n%. št%.$",
	millennium = "^%d*%..tisočletje$",
	millennium_bc = "^%d*%..tisočletje pr%. n%. št%.$"
}

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