Module:Archives

local p = {}

function p.listing( frame ) local page = mw.allToString( mw.title.getCurrentTitle ).."/Archive " local out = {} for i = 10, 100, 10 do       if mw.title.new( page..i ).exists then for j = i - 9, i do               table.insert( out, "#"..j.."" ) end else if mw.title.new( page..(i - 5) ).exists then for j = i - 9, i - 5 do                   table.insert( out, "#"..j.."" ) end for j = i - 4, i do                   if mw.title.new( page..j ).exists then table.insert( out, "#"..j.."" ) else break end end else for j = i - 9, i do                   if mw.title.new( page..j ).exists then table.insert( out, ""..page..j.."|#"..j.."" ) else break end end end break end end return table.concat( out, ", " ) end

return p