Jump to content

Module:NYC bus link/sandbox: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Create sandbox version of Module:NYC bus link
 
test
Line 20: Line 20:
end
end
return table.concat (result, ', ');
local prose;
if 'yes' == args.prose then
return mw.text.listToText (result, ', ', ', and');
else
return table.concat (result, ', ');
end
end
end



Revision as of 22:42, 8 July 2018

require('Module:No globals');
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' == args.prose then
		return mw.text.listToText (result, ', ', ', and');
	else
		return table.concat (result, ', ');
	end
end

return p;