Jump to content

Module:Signpost/archives index

From Wikipedia, the free encyclopedia
local p = {}
local start = 2000
local finish = 2105
local output = {}
local count = 0

local function catexists(title)
	return mw.title.new(title, 'Category').exists
end

function p.main(frame)
	
	for year = start, finish do
		local link = string.format("Wikipedia:Wikipedia Signpost/Archives/%d", year)
		local display = year

		if catexists(link) then
			local entry = "*"..string.format("[[%s|%s]]", link, display)
			count = count + 1
        if count % 10 == 0 then
				entry = entry .. "<br/> <br/>"    end
			table.insert(output, entry)
		end
	end

	return table.concat(output, "\n")
end

return p