Module:NYC bus link: Difference between revisions
Appearance
Content deleted Content added
EdJohnston (talk | contribs) m Protected "Module:NYC bus link": Highly visible template: Request at WP:RFPP ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite)) |
adding columbia transportation |
||
Line 16: | Line 16: | ||
elseif 'nj' == args.city then |
elseif 'nj' == args.city then |
||
city = 'New Jersey bus'; |
city = 'New Jersey bus'; |
||
elseif 'columbia' == args.city then |
|||
city = 'Columbia Transportation' |
|||
else |
else |
||
return table.concat ({'<span style=\"font-size:100%; font-style:normal;\" class=\"error\">unexpected city: ', args.city, '</span>'}) |
return table.concat ({'<span style=\"font-size:100%; font-style:normal;\" class=\"error\">unexpected city: ', args.city, '</span>'}) |
Revision as of 16:46, 8 December 2020
{{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 result = {};
local city;
args.city = args.city:lower();
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';
elseif 'columbia' == args.city then
city = 'Columbia Transportation'
else
return table.concat ({'<span style=\"font-size:100%; font-style:normal;\" class=\"error\">unexpected city: ', args.city, '</span>'})
end
for _, name in ipairs (args) do
table.insert (result, table.concat ({'[[', name, ' (', city, ')|', name, ']]'}))
end
if ('yes' == args.prose) or ('y' == args.prose) then
return mw.text.listToText (result);
else
return table.concat (result, ', ');
end
end
return p;