Module:Sandbox/PhiH/Route
(Redirected from Module:User:PhiH/Route)
![]() | This module is rated as pre-alpha. It is unfinished, and may or may not be in active development. It should not be used from article namespace pages. Modules remain pre-alpha until the original editor (or someone who takes one over if it is abandoned for some time) is satisfied with the basic structure. |
Usage
{{#invoke:Sandbox/PhiH|route=|inv=}}
Stnlnk
if {{{2}}} if empty:
- {{{1}}} railway station
else:
- {{{1}}}_railway_station_({{{2}}})
- {{{1}}}_({{{2}}})_railway_station
- {{{1}}}_({{{2}}}_station)
- {{{1}}}_station_({{{2}}})
- {{{1}}}_({{{2}}})
- {{{1}}} railway station, {{{2}}}
local p = {}
function p.route(frame)
local route = frame.args.route
local inv = frame.args.inv
local station = frame.args.station
local listall = frame.args.listall
local ilist = mw.text.split(route, '\n')
local output = ''
local list = {}
if not (int == '') then
for i, v in ipairs(ilist) do
list[#ilist - i + 1] = v
end
else list = ilist end
for i, v in ipairs(list) do
local entry = mw.text.split(v, '\\')
if (entry[1] == station) then output = output .. '–\'\'\'' .. v .. '\'\'\''
elseif (#entry == 1 or entry[2] == 'M') and not (listall == '') then
if not (i == 1) then output = output .. ' – ' end
output = output .. stnlnk(entry[1], entry[3])
end
end
return output
end
function p.stnlnk(frame)
local station = frame.args[1]
local link = frame.args[2]
return stnlnk(station, link)
end
function stnlnk(station, link)
if link == nil then link = station .. ' railway station' end
return '[[' .. link .. '|' .. station .. ']]'
end
return p