Module:Sandbox/Szqecs/L-rail/Version 2 explained

local p =

local s = local style =

function p.top return '

-' .. '\n! ' .. style['header leftcell'] .. 'Preceding station' .. '\n' .. style['header midcell'] .. system .. '\n! ' .. style['header rightcell'] .. 'Following station'end

function p.line(line, color, left, right, leftToward, rightToward) return '

-' .. '\n' .. style['body leftcell'] .. left .. leftToward .. '\n' .. style['body banner'] .. color .. '" ' .. '\n' .. style['body midcell'] .. line .. '\n' .. style['body banner'] .. color .. '" ' .. '\n' .. style['body rightcell'] .. right .. rightTowardend

function p.bottom return '

'end

function p.main(frame) local a = frame.args local d = require('Module:Sandbox/Szqecs/L-rail/' .. a.system) local function link(s1, s2) if s1 and s2 then return '\[\[' .. s1 .. '|' .. s2 .. '\]\]' elseif s1 then return '\[\[' .. s1 .. '\]\]' else return end end local function subFormat(s) if s ~= then return '

' .. s .. '

' else return end end local system = link(d['system']) local line = link(d[a.line]['lines']) local color = d[a.line]['color'] if not left then left = "Terminus" else left = link(d[a.line]['stations'][a.left]) end if not right then right = "Terminus" else right = link(d[a.line]['stations'][a.right]) end if not a.left then leftToward = elseif a.left

d[a.line]['leftToward'] then leftToward = subFormat('Terminus') else leftToward = subFormat('toward ' .. link(d[a.line]['leftTowardLink'], d[a.line]['leftToward'])) end if not a.right then rightToward = elseif a.right

d[a.line]['rightToward'] then rightToward = subFormat('Terminus') else rightToward = subFormat('toward ' .. link(d[a.line]['rightTowardLink'], d[a.line]['rightToward'])) end return p.line(line, color, left, right, leftToward, rightToward) -- return line(a.System, a.Line, a.Previous, a.Next, a.Type, a.Type2, a.Note, a.Note2, a.Notemid, a.Oneway2, a.Row1, a.hide)end

return p