Module:Year navigation: Difference between revisions
Appearance
Content deleted Content added
tonumber |
gah. quotes |
||
Line 14: | Line 14: | ||
if year > 2000 then |
if year > 2000 then |
||
millenium = [[3rd millenium]] |
millenium = "[[3rd millenium]]" |
||
elseif year > 1000 then |
elseif year > 1000 then |
||
millenium = [[2nd millenium]] |
millenium = "[[2nd millenium]]" |
||
elseif year > 0 then |
elseif year > 0 then |
||
millenium = [[1st millenium]] |
millenium = "[[1st millenium]]" |
||
else |
else |
||
millenium = [[1st millenium BC|1st millenium <small>BC</small>]] |
millenium = "[[1st millenium BC|1st millenium <small>BC</small>]]" |
||
end |
end |
||
Revision as of 01:55, 19 August 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 millenium
if year > 2000 then
millenium = "[[3rd millenium]]"
elseif year > 1000 then
millenium = "[[2nd millenium]]"
elseif year > 0 then
millenium = "[[1st millenium]]"
else
millenium = "[[1st millenium BC|1st millenium <small>BC</small>]]"
end
return infobox.infobox({
label1 = "[[List of decades, centuries, and millennia|Millennium]]:",
data1 = millenium
})
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