跳转到内容

模組:Vgr/sandbox

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

这是本页的一个历史版本,由D2F0F5留言 | 贡献2014年8月7日 (四) 14:37编辑。这可能和当前版本存在着巨大的差异。

local p = {}

local arealist = {
	
	{'KR', '[[韩国|-{zh-cn:韩国; zh-tw:南韓;}-]]'};
	{'JP', '[[日本]]'};
	{'INT', '[[国际化与本地化|国际]]'};
	{'WW', '[[国际]]'};
	{'NA', '[[北美]]'};
	{'PAL', '[[PAL区]]'};
	{'EU', '[[欧洲]]'};
	{'AU', '[[澳洲]]'}; -- 兼容{{Vgrelease new}}的使用参数
	{'AUS', '[[澳洲]]'}; -- 兼容{{Vgrelease}}的使用参数
	{'CN', '[[中国大陆|大陆]]'};
	{'TWHK', '[[台湾|台]][[香港|港]]'};
	{'TW', '[[台湾]]'};
	{'HK', '[[香港]]'};
	{'SEA', '[[东南亚]]'};
	{'SG', '[[新加坡]]'};
	{'MY', '[[马来西亚]]'};

}

local function vgn(area, context)

	local ret
	local i = 0
	
	repeat
		i = i + 1
		if arealist[i] == nil then 
			i = nil 
			break
		end
	until arealist[i][1] == area
	
	if i == nil then
		ret = area .. ':' .. context .. '<br />'
	else
		ret = arealist[i][2] .. ':' .. context .. '<br />'
	end
	
	return ret
end

function p.vgrelease(frame)
	
	local pframe = frame:getParent()
	local args = pframe.args
	local ret = ''
	local i = 0
	
	repeat
		i = i + 1
		if args[arealist[i][1]] ~= nil and args[arealist[i][1]] ~= ''  then
			ret = ret .. arealist[i][2] .. ':' .. args[arealist[i][1]] .. '<br />'
		end
	until arealist[i+1] == nil

	if args[4] ~= nil and args[4] ~= '' then
		i = 1
		while args[i+1] ~= nil do
			ret = ret .. vgn(args[i], args[i+1])
			i = i + 2
		end
	elseif args[3] ~= nil and args[3] ~= '' then
		ret = ret .. '[[' .. args[1] .. '|' .. args[2] .. ']]:' .. args[3]
		
	elseif args[2] ~= nil and args[2] ~= '' then
		ret = ret .. args[1] .. ':' .. args[2]
	end

	return ret
end

return p