Module:Category series navigation/navyear/sandbox: Difference between revisions

Content deleted Content added
m Undid revision 866838191 by Tom.Reding (talk) working
Convert to loop
Line 7:
local arg2 = tonumber(frame.args[2])
local arg3 = frame.args[3]
returnlocal navyear = '{| class="toccolours hlist" style="text-align: center; margin: auto;"\n' .. '|\n'
 
'|\n' ..
local i = -5
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2-5)..' '..arg3, (arg2-5) } }..'\n' ..
while i <= 5 do
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2-4)..' '..arg3, (arg2-4) } }..'\n' ..
local year = arg2 + i
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2-3)..' '..arg3, (arg2-3) } }..'\n' ..
if i ~= 0 then
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2-2)..' '..arg3, (arg2-2) } }..'\n' ..
navyear = navyear..'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2-1)year..' '..arg3, (arg2-1)year } }..'\n' ..
else
navyear = navyear..'*<b>'..arg2..'</b>\n' ..
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2+1)..' '..arg3, (arg2+1) } }..'\n' ..
end
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2+2)..' '..arg3, (arg2+2) } }..'\n' ..
i = i + 1
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2+3)..' '..arg3, (arg2+3) } }..'\n' ..
end
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2+4)..' '..arg3, (arg2+4) } }..'\n' ..
return navyear..'|}'
'*'..frame:expandTemplate{ title = 'LinkCatIfExists2', args = { arg1..' '..(arg2+5)..' '..arg3, (arg2+5) } }..'\n' ..
'|}'
end