Documentation for this module may be created at Module:Sandbox/Jc86035/1/doc
--[[
This is a module for use in substitution and replacement of Template:Infobox MTR station on MTR Light Rail articles.
]]
p = {}
function p.main(frame)
local routes, tmp, result = frame.args[1] or '', {}, {}
for k, v in ipairs({'614P', '615P', '751P'}) do
if mw.ustring.find(routes, v) then
tmp[v] = true
routes = mw.ustring.gsub(routes, v, '')
end
end
for k, v in ipairs({'505', '507', '610', '614', '615', '705', '706', '751', '761P'}) do
if mw.ustring.find(routes, v) then tmp[v] = true end
end
for k, v in ipairs({'505', '507', '610', '614', '614P', '615', '615P', '705', '706', '751', '751P', '761P'}) do
if tmp[v] then
table.insert(result, v)
end
end
if #result > 1 then return 'routes '..mw.text.listToText(result) end
if #result > 0 then return 'route '..mw.text.listToText(result) end
end
return p