local p = {}

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

function p._main(args)
	local ret = {}
	for i, title in ipairs(args) do
		if args['text' .. i] and args['text' .. i] ~= '' then
			ret[#ret + 1] = string.format('<span id="%s">[[:%s|%s]]</span>', mw.language.getContentLanguage():ucfirst(title), title, args['text' .. i])
		else
			ret[#ret + 1] = string.format('<span id="%s">[[:%s]]</span>', mw.language.getContentLanguage():ucfirst(title), title)
		end
	end
	ret = mw.text.listToText(ret, '、', '、')
	return ret
end

return p