Jump to content

Module:Sandbox/PhiH/Route

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PhiH (talk | contribs) at 07:06, 18 December 2020 (inversion added). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local p = {} 
function p.route(frame)
    local route = frame.args.route
    local inv = frame.args.inv
    local station = frame.args.station
    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
    	if not (i == 1) then output = output .. '–' end
    	if (v == station) then output = output .. '\'\'\'' .. v .. '\'\'\''
    	else output = output .. '[[' .. v .. ' railway station|' .. v .. ']]' end
    end
    return output
end
return p