Module:Adjacent stations: Difference between revisions

Content deleted Content added
Enabled single transclusion.
Undid revision 838011693 by Szqecs (talk)
Line 1:
-- Function allowing for consistent treatment of boolean-like wikitext input.
-- It works similarly to the template {{yesno}}.
 
local yesno = require("Module:Yesno")
 
local _style = {
['3'] = 'style="width: 30%;',
Line 75 ⟶ 79:
function p.top()
return table.concat({'{| class="wikitable" ', style['table']})
end
 
function p.rail(data)
header = return table.concat({'\n|-',
'\n!', style['header leftcell'], 'Preceding station',
'\n!', style['header midcell'], data[i]['system title'],
'\n!', style['header rightcell'], 'Following station'})
})
end
 
Line 89 ⟶ 101:
for i = 1, #args.line do
local _line = data[i][args.line[i]]
lineTitle[i] = _line['line title']
Line 135 ⟶ 147:
end
end
table.insert(t, table.concat({header'\n|-',
if args.system[i] then
header = table.concat({'\n|-',
'\n!', style['header leftcell'], 'Preceding station',
'\n!', style['header midcell'], data[i]['system title'],
'\n!', style['header rightcell'], 'Following station'})
else
header = ''
end
table.insert(t, table.concat({header,
'\n|-',
'\n|', style['body leftcell'], left[i], leftTerminus[i],
'\n|', style['body banner'], colour[i], '"| ',
Line 164 ⟶ 165:
function p.main(frame)
local args = {
['system'] = {}frame:getParent().args.system,
['line'] = {},
['left'] = {},
Line 177 ⟶ 178:
['circularR'] = {}
}
local data = require('Module:L-rail/' .. args.system)
 
for k, v in pairs(frame:getParent().args) do
local a = string.match(k, '(%a+)%d+')
if not a then
Line 188 ⟶ 190:
end
if a == 'systemline' then
args.system[b] = v
elseif a == 'line' then
args.line[b] = v
elseif a == 'left' then
Line 219:
end
local _rows = frame:getParent().args.rows or 'all'
local datarows = {}
for i = 1, #args.line do
['all'] = table.concat({p.top(), p.rail(data), p.line(data, args), p.bottom()}),
if args.system[i] then
data[i'top'] = requiretable.concat('Module:L-{p.top(), p.rail/'(data), p..line(data, args.system[i])}),
['topmid'] = table.concat({p.toprail(data), p.line(data, args)}),
else
['bottom'] = table.concat({p.rail(data), p.line(data, args), p.bottom()})
data[i] = data[i-1]
end
end
local rows = { -- To be removed. Included for backwards compatibility.
['all'] = table.concat({p.top(), p.line(data, args), p.bottom()}),
['top'] = table.concat({p.top(), p.line(data, args)}),
['mid'] = table.concat({p.line(data, args)}),
['bottom'] = table.concat({p.line(data, args), p.bottom()})
}
return rows['all'_rows]
if frame.args.rows then
return rows[frame.args.rows]
else
return rows['all']
end
end