Module:Adjacent stations/sandbox: Difference between revisions

Content deleted Content added
No edit summary
Temporary testing. Reverting later.
Line 88:
local t = {}
function mapArg(i, v)
for i, v in ipairs(index) do
if args.system[v] then
table.insert(t, table.concat({'\n|-',
Line 104:
local _line = data[v][args.line[v]]
lineTitle[v] = _line['line title']
colour[v] = _line.colour or _line.color
note[v] = args.note[v] or ''
Line 170:
table.insert(t, table.concat({'\n|', style['body rightcell'], right[v], rightTerminus[v]}))
end
end
for i, v in ipairs(index) do
mapArg(i, v)
end
Line 216 ⟶ 219:
-- to do: add rest of S-line parameters
local _index = {}
local parametersfunction =mapArg(key, {value)
['strings']local parameters = {
['systemstrings'] = 'system',{
['linesystem'] = 'linesystem',
['leftline'] = 'leftline',
['rightleft'] = 'rightleft',
['right'] = 'right'
},
['optional strings'] = {
['noteoptional strings'] = 'note',{
['typenote'] = 'Typenote',
['type-left'] = 'TypeLType',
['type-rightleft'] = 'TypeRTypeL',
['type-right'] = 'TypeR',
-- ['through'] = 'through', -- The way this would work is that it would replace either "Terminus" cell, rather than just one of them in particular.
-- ['through-left'] = 'throughL',
-- ['through-rightleft'] = 'throughRthroughL',
-- ['branchthrough-right'] = 'branchthroughR',
-- ['transferbranch'] = 'transferbranch',
-- ['transfer'] = 'transfer'
},
['optional boolean'] = {
['oneway-leftoptional boolean'] = 'onewayL',{
['oneway-rightleft'] = 'onewayRonewayL',
-- ['roundoneway-leftright'] = 'roundLonewayR',
-- ['round-rightleft'] = 'roundRroundL',
-- ['circularround-right'] = 'circularroundR',
['circular-left'] = 'circularLcircular',
['circular-rightleft'] = 'circularRcircularL',
['throughcircular-leftright'] = 'throughLcircularR',
['through-rightleft'] = 'throughRthroughL',
-- ['through-leftright'] = 'throughLthroughR',
}
}
local a = string.match(kkey, '(%a+)%d+') or kkey
}
local b = tonumber(string.match(kkey, '%a+(%d+)')) or 1
for k, v in pairs(_args) do
local a = string.match(k, '(%a+)%d+') or k
local b = tonumber(string.match(k, '%a+(%d+)')) or 1
if parameters['strings'][a] then
args[parameters['strings'][a]][b] = vvalue
_index[b] = true
elseif args[parameters['optional strings'][a]] then
args[parameters['optional strings'][a]][b] = vvalue
elseif args[parameters['optional boolean'][a]] then
args[parameters['optional boolean'][a]][b] = yesno(vvalue)
end
end
for k, v in pairs(_args) do
mapArg(k, v)
end
 
local index = {}
local function buildIndex(k)
for k, v in pairs(_index) do
table.insert(index, k)
end
for k, v in pairs(_index) do
buildIndex(k)
end
table.sort(index)
local data = {}
local function getData(i, v)
for i, v in ipairs(index) do
if args.system[v] then
-- data[v] = require('Module:L-rail/' .. args.system[v])
Line 275 ⟶ 284:
end
end
for i, v in ipairs(index) do
getData(i, v)
end
}
local rows = { -- Included for mixed used with S-line.