local _style = {
['3'] = 'style="width: 30%;',
, ['c'] = 'style="text-align: center;',
, ['v'] = 'vertical-align: middle;',
, ['bd'] = 'border:',
, ['t'] = 'border-top:',
, ['bb'] = 'border-bottom:',
, ['L'] = 'border-left:',
, ['r'] = 'border-right:',
, ['n'] = 'none;',
, ['0'] = '0px none;',
, ['1'] = '1px solid #aaa;'
}
local style = {
['table'] = table.concat({'style="width: 55%; margin:0.5em auto; font-size:95%; clear:both;',
, _style['t'], _style['0'],
, 'border-collapse: separate;" cellspacing="0" cellpadding="-1"'
}),
, ['header leftcell'] = table.concat({_style['3'], _style['v'],
, _style['bd'], _style['1'],
, _style['L'], _style['n'],
, _style['bb'], _style['n'],
, '"|'
}),
, ['header banner'] = table.concat({'style="',
, _style['bd'], _style['n'],
, _style['t'], _style['1'],
, '"|'
}),
, ['header midcell'] = table.concat({'colspan="3" style="', _style['v'],
, _style['bd'], _style['n'],
, _style['t'], _style['1'],
, '"|'
}),
, ['header rightcell'] = table.concat({_style['3'], _style['v'],
, _style['bd'], _style['1'],
, _style['r'], _style['n'],
, _style['bb'], _style['n'],
, '"|'
}),
, ['body leftcell'] = table.concat({_style['c'], _style['v'],
, _style['L'], _style['0'],
, _style['bb'], _style['0'],
, _style['r'], _style['1'],
, _style['t'], _style['1'],
, '"|'
}),
, ['body banner'] = table.concat({_style['c'],
, _style['L'], _style['0'],
, _style['bb'], _style['0'],
, _style['r'], _style['0'],
, _style['t'], _style['1'],
, 'width: 8px; background-color: #'
}),
, ['body midcell'] = table.concat({_style['c'], _style['v'],
, _style['bb'], _style['0'],
, '"|'
}),
, ['body rightcell'] = table.concat({_style['c'], _style['v'],
, _style['L'], _style['1'],
, _style['bb'], _style['0'],
, _style['r'], _style['0'],
, _style['t'], _style['1'],
, '"|'
})
}
function p.rail(data)
return table.concat({'\n|-',
, '\n!', style['header leftcell'], 'Preceding station',
, '\n!', style['header midcell'], data['system title'],
, '\n!', style['header rightcell'], 'Following station'
})
end
end
end
table.insert(t, table.concat({'\n|-',
, '\n|', style['body leftcell'], left[i], leftTerminus[i],
, '\n|', style['body banner'], colour[i], '"| ',
, '\n|', style['body midcell'], lineTitle[i], '<div style="font-size: smaller">', note[i], '</div>' ,
, '\n|', style['body banner'], colour[i], '"| ',
, '\n|', style['body rightcell'], right[i] , rightTerminus[i]
}))
end
function p.main(frame)
local args = {
['system'] = frame:getParent().args.system,
, ['line'] = {},
, ['left'] = {},
, ['right'] = {},
, ['TypeL'] = {},
, ['TypeR'] = {},
, ['note'] = {},
, ['onewayL'] = {},
, ['onewayR'] = {},
, ['circular'] = {},
, ['circularL'] = {},
, ['circularR'] = {}
}
local data = require('Module:L-rail/' .. args.system)
local _rows = frame:getParent().args.rows or 'all'
local rows = {
['all'] = table.concat({p.top(), p.rail(data), p.line(data, args), p.bottom()}),
, ['top'] = table.concat({p.top(), p.rail(data), p.line(data, args)}),
, ['mid'] = table.concat({p.rail(data), p.line(data, args)}),
, ['bottom'] = table.concat({p.rail(data), p.line(data, args), p.bottom()})
}
return rows[_rows]
|