Module:Link list

From OSDev.wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Link list/doc

local p = {}
-- generates a list like: "[[a]], [[b]] and [[c]]"
function p.listPages( f )
	local args = require('Module:ProcessArgs').merge()
	local out = ''
	for index, value in ipairs(args) do
		if index == 1 then
		elseif index == #args then
			if f.args["or"]~=nil then
				out = out .. ' or '
			else
				out = out .. ' and '
			end
		else
			out = out .. ', '
		end
		if f.args.template~=nil then
			out = out .. '<code>{{[[Template:' .. value .. '|' .. value .. ']]}}</code>'
		else
			out = out .. '[[' .. value .. ']]'
		end
	end
	return out
end
return p