Jump to content

Module:Sandbox/CAS222222221

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 風中的刀劍 (talk | contribs) at 15:14, 16 July 2015. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local getArgs = require('Module:Arguments').getArgs
local p = {}

local function color(args, year)
	return '#FF6666'
end

local function titleItem(content)
	local ret
	
	if a ~= nil then
		ret = mw.html.create( 'span' )
		ret
			:css( 'text-indent', '-1em')
			:wikitext( '-' .. context )
	end
	
	return ret
end

local function left(args, year)
	local ret
	ret = mw.html.create( 'td' )
	
	ret
		:wikitext( year .. '-' )
		
	return ret
end

local function middle(args, year)
	local ret
	ret = mw.html.create( 'td' )
	
	ret
		:wikitext( 'nbsp;' )
		:css( 'width', '10px' )
		:css( 'background-color', color(args, year) )
		
	return ret
end

local function right(args, year)
	local ret
	local cont
	
	ret = mw.html.create( 'td' )
	
	for i = 98, 106 do
		ret:node( titleItem(args[year .. string.char(i)]) )
	end
	ret
		:css( 'padding-left', '1em')
		
	return ret
end

local function row(args, year)
	local ret
	ret = mw.html.create('tr')
	
	ret
		:node( left(args, year) )
		:node( middle(args, year) )
		:node( right(args, year) )
		
	return ret
end

--------------------------------------------------------------------------------

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	-- Main module code goes here.
	local ret
	ret = mw.html.create( 'table' )
	
	for i = 1990, 2015 do
		ret:node( row(args, year) )
	end
	
	return ret
end

return p