Module:Category series navigation/navyear/sandbox
![]() | This is the module sandbox page for Module:Category series navigation/navyear (diff). |
Use {{Category series navigation}} instead.
local p = {}
function p.navyear(frame)
--Expects a PAGENAME of the form "Some sequential 2015 example cat", where {{{1}}}=Some sequential, {{{2}}}=2015, {{{3}}}=example cat,
--TODO: and an optional 'minumum year' parameter {{{4}}}=1758
local arg1 = frame.args[1]
local arg2 = tonumber(frame.args[2])
local arg3 = frame.args[3]
local navyear = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n' .. '|\n'
local i = -5
while i <= 5 do
local year = arg2 + i
if i ~= 0 then
navyear = navyear..'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..year..' '..arg3, year } }..'\n'
else
navyear = navyear..'*<b>'..arg2..'</b>\n'
end
i = i + 1
end
return navyear..'|}'
end
return p