模块:InfoBoxBuilder

来自希灵百科
跳转至: 导航搜索

此模块的文档可以在模块:InfoBoxBuilder/doc创建

local p = {}

local canLink = require('Module:Linker')._canLink;
local parse = require('Module:Array').parse;

function p.multirow(frame)
	local values = parse(frame.args['value'])
	local builder = '|-'
	builder = builder .. '\n!' .. 'rowspan=' .. tostring(#values) .. ' ' .. (frame.args['capmixin'] or '') .. '|' .. frame.args['caption']
	local first = true
	for i,v in pairs(values) do
		if first then
			first = false
		else
			builder = builder .. '\n|-'
		end
		builder = builder .. '\n|' .. (frame.args['valmixin'] or '') .. '|'
		if frame.args['trylink'] ~= nil then
			if canLink(v) then
				builder = builder .. '[[' .. v .. ']]'
				if frame.args['linkcat'] ~= nil then
					builder = builder .. '[[Category:' .. v .. ']]'
				end
			else
				builder = builder .. v;
			end
		else
			builder = builder .. v;
		end
	end
	return builder
end

return p
为本页面评分: