Jump to content

Module:Year navigation: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
gah. quotes
m typo: millennium (via WP:JWB)
 
Line 11: Line 11:
end
end
local millenium
local millennium
if year > 2000 then
if year > 2000 then
millenium = "[[3rd millenium]]"
millennium = "[[3rd millennium]]"
elseif year > 1000 then
elseif year > 1000 then
millenium = "[[2nd millenium]]"
millennium = "[[2nd millennium]]"
elseif year > 0 then
elseif year > 0 then
millenium = "[[1st millenium]]"
millennium = "[[1st millennium]]"
else
else
millenium = "[[1st millenium BC|1st millenium <small>BC</small>]]"
millennium = "[[1st millennium BC|1st millennium <small>BC</small>]]"
end
end
return infobox.infobox({
return infobox.infobox({
label1 = "[[List of decades, centuries, and millennia|Millennium]]:",
label1 = "[[List of decades, centuries, and millennia|Millennium]]:",
data1 = millenium
data1 = millennium
})
})
end
end

Latest revision as of 13:06, 8 October 2023

local getArgs = require("Module:Arguments").getArgs
local infobox = require("Module:Infobox")

local p = {}

function p._main(args)
	local year = tonumber(args[1])
	
	if year == 0 then
		return error("Year cannot be 0. There was no [[year 0]].")
	end
	
	local millennium
	
	if year > 2000 then
		millennium = "[[3rd millennium]]"
	elseif year > 1000 then
		millennium = "[[2nd millennium]]"
	elseif year > 0 then
		millennium = "[[1st millennium]]"
	else
		millennium = "[[1st millennium BC|1st millennium <small>BC</small>]]"
	end
	
	return infobox.infobox({
		label1 = "[[List of decades, centuries, and millennia|Millennium]]:",
		data1 = millennium
	})
end

function p.main(frame)
	local args = getArgs(frame)
	if not args[1] then
		args[1] = frame:getTitle()
	end
	
	return p._main(args)
end

return p