Module:Adjacent stations: Difference between revisions

Content deleted Content added
m groundwork for table cell merging
Made nums independent (out of args) and renamed. Renamed tmp.
Line 77:
end
 
function p.line(dataargs, argsindex, data)
local lineTitle = {}
local colour = {}
Line 88:
local t = {}
for ki, v in ipairs(args.numsindex) do
if args.system[v] then
table.insert(t, table.concat({'\n|-',
Line 98:
if args.line[v] or args.left[v] or args.right[v] then
if not args.line[v] then args.line[v] = args.line[args.numsindex[ki-1]] end
local _line = data[v][args.line[v]]
lineTitle[v] = _line['line title']
Line 161:
 
function p.main(frame)
local _args = frame:getParent().args
local args = {
nums = {},
system = {},
line = {},
Line 176:
circularR = {}
}
local _args = frame:getParent().args
local tmp_index = {}
for k, v in pairs(_args) do
local a = string.match(k, '(%a+)%d+')
Line 190:
if a == 'system' then
args.system[b] = v
tmp_index[b] = true
elseif a == 'line' then
args.line[b] = v
tmp_index[b] = true
elseif a == 'left' then
args.left[b] = v
tmp_index[b] = true
elseif a == 'right' then
args.right[b] = v
tmp_index[b] = true
elseif a == 'typeL' then
args.TypeL[b] = v
Line 223:
end
local index = {}
for k, v in pairs(tmp_index) do table.insert(args.numsindex, k) end
table.sort(args.numsindex)
local data = {}
for ki, v in ipairs(args.numsindex) do
if args.system[v] then
data[v] = require('Module:L-rail/' .. args.system[v])
else
data[v] = data[args.numsindex[ki-1]]
end
end
local rows = { -- To be removed. Included for backwards compatibility.
['all'] = table.concat({p.top(), p.line(dataargs, argsindex, data), p.bottom()}),
['top'] = table.concat({p.top(), p.line(dataargs, argsindex, data)}),
['mid'] = table.concat({p.line(dataargs, argsindex, data)}),
['bottom'] = table.concat({p.line(dataargs, argsindex, data), p.bottom()})
}