Module:Sandbox/BrandonXLF/1

This is an old revision of this page, as edited by BrandonXLF (talk | contribs) at 03:13, 22 June 2022. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local mDate = require('Module:Date')
local Date = mDate._Date
local p = {}
	
function p.main()
	local currentDate = Date('currentdate')
	local date = Date('1 December 2010')
	local out = '<table>'
	local currentMonth
	local currentYear
	
	while date ~= currentDate do
		if date.year ~= currentYear then
			out = out .. '</td></tr></table><h2>' .. date.year .. '</h2><table>'
			currentYear = date.year
		end
		
		if date.monthabbr ~= currentMonth then
			out = out .. '</td></tr><tr><th scope="row" style="text-align:left;">' .. date.monthabbr .. '</th><td>'
			currentMonth = date.monthabbr
		end
		
		out = out .. '[[Wikipedia:Main Page history/' .. date:text('%Y %B %-d') .. '|' .. date:text('%-d') .. ']]' .. '/[[Wikipedia:Main Page history/' .. date:text('%Y %B %-d') .. 'b|b]] '
		
		date = date + 1
	end
	
	return out .. '</td></tr></table>'
end

return p