Documentation for this module may be created at Module:Timeline/doc

local p = {}

-- --
-- =p.main({args={}})
--
p.main = function ( frame )
	local thisYear = tonumber( mw.title.getCurrentTitle().text )
	if thisYear == nil then
		thisYear = os.date( '*t' ).year
	end
	local minYear = thisYear - 7
	local maxYear = thisYear + 7
	local out = '<div class="mdl-timeline"><strong class="mdl-timeline-main-header">[[Timeline]]:</strong> [[' .. ( minYear - 1 ) .. '|&larr;]] '
	for y = minYear, maxYear do
	    out = out .. '[[' .. y .. ']] '
	end
	local styles = mw.getCurrentFrame():extensionTag( 'templatestyles', nil, { src = 'Module:Timeline/styles.css' } )
	return out .. ' [[' .. ( maxYear + 1 ) .. '|&rarr;]]</div>' .. styles
end


p.index = function ( frame )
	local startingYear = 1829
	local currentYear = os.date( '*t' ).year
	local out = '<div class="mdl-timeline-index">'
	for y = startingYear, currentYear do
	    out = out .. '[[' .. y .. ']] '
	end
	local styles = mw.getCurrentFrame():extensionTag( 'templatestyles', nil, { src = 'Module:Timeline/styles.css' } )
	return out .. '</div>' .. styles
end

return p