Module:NYC bus link: Difference between revisions
Appearance
Content deleted Content added
Epicgenius (talk | contribs) see Module:Sandbox/Epicgenius/NYC bus link for history |
Epicgenius (talk | contribs) fix |
||
Line 11: | Line 11: | ||
elseif 'LI' == args.city then |
elseif 'LI' == args.city then |
||
city = 'Long Island bus'; |
city = 'Long Island bus'; |
||
elseif 'NJ' == args.city then |
|||
city = 'New Jersey bus'; |
|||
end |
end |
||
Revision as of 22:30, 8 July 2018
{{Module rating }}
Usage
This module can be used to call a comma-separated list of New York City area bus routes in the format [[''Route name'' (''city name'' bus)|''Route name'']]
.
{{#invoke:NYC bus link}}
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
return table.concat (result, ', ');
end
return p;