Module:InfoBoxBuilder

From Moegirlpedia
Jump to: navigation, search
Template-info.svg Module Documentation  [Create] [Refresh]
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