跳转到内容

模組:VG table

维基百科,自由的百科全书

这是本页的一个历史版本,由風中的刀劍留言 | 贡献2015年4月13日 (一) 08:55编辑。这可能和当前版本存在着巨大的差异。

local getArgs = require('Module:Arguments').getArgs
 
local function makeInvokeFunc(funcName)
	return function (frame)
		local args = getArgs(frame)
		return p[funcName](args)
	end
end
 
local p = {}
 
p.main = makeInvokeFunc('_main')
 
function p._main(args)
	-- Code for the first function goes here.

	local ret
	local col = args.coloum-3 and 3 or 5

	local function col( col3, col5 )
		if col == 3 then
			return col3
		else
			return col5
		end
	end

	ret =        '{| class="wikitable plainrowheaders" width="100%" align="center" style="font-size: ' .. col( '100%', '95%' ) .. ';"' .. '\n'
	ret = ret .. '|- style="text-align: center;"' .. '\n'
	ret = ret .. '! scope="col" width="' .. col( '31%', '20%' ) .. '" align="center" rowspan="2" | 作品' .. '\n'
	ret = ret .. '! colspan="' .. col( '3', '5' ) .. '" | 首次发行日期' .. '\n'
	for i = 1, col do
		ret = ret .. '! scope="col" style="padding: 0 1% 0 1%; text-align: center; width: ' .. col( '23%', '16%' ) .. '; font-weight: bold; background-color: transparent;" |' .. args['region' .. i] .. '\n'
	end
	ret = ret .. args.body .. '\n'
	ret = ret .. '|}'
	
	return ret
end
 
p.item = makeInvokeFunc('_item')
 
function p._item(args)
	-- Code for the second function goes here.
	local ret
	local col = args.coloum-3 and 3 or 5
	
	ret = '|- bgcolor="#F2F2F2" align="center"' .. '\n'
	ret = ret .. '! scope="row" style="text-align: center;" | ' .. args.title
	for i = 1, col do
		ret = ret .. '|' .. args['release' .. i] .. '\n'
	end
	if args.notes then
		ret = ret .. '|-' .. '\n'
		ret = ret .. '| scope="row" colspan="' .. ( col + 1 ) .. '" style="border: none; vertical-align: top; background-color: transparent; text-align: left;" | <b>注解:</b>' .. '\n'
		ret = ret .. args.notes .. '\n'
	end
	
	return ret
end

return p