require('strict');
local getArgs = require('Module:Arguments').getArgs
local p = {}

function p.getLink(frame)
	local args = getArgs(frame);
	local city;
	
	if 'NYC' == args.city then
		city = 'New York City bus';
	elseif 'LI' == args.city then
		city = 'Long Island bus';
	elseif 'NJ' == args.city then
		city = 'New Jersey bus';
	end
		
	local result = {};
	for _, name in ipairs (args) do
		table.insert (result, table.concat ({'[[', name, ' (', city, ')|', name, ']]'}))
	end
	
	
	local prose;
	if 'yes' or 'y' == args.prose then
		return mw.text.listToText (result, ', ', ' and ');
	else
		return table.concat (result, ', ');
	end
end

return p;