User:Szqecs/sandbox/L-rail doc

This is a Lua/Scribunto version of S-line, a specialised succession box template that links railway station articles.

Usage
Unlike S-line, this template only needs to be transcluded once. Parameters may be suffixed by a number for the template to include multiple systems or lines (unless otherwise noted).

Making it work
L-rail depends on a sub-module for the proper display of information. For an example, here are the templates necessary to properly display this box (a version of which is at Hsinchu HSR station):

First of all, here's the underlying code:

You can see that L-rail takes only parameters – no linking necessary! L-rail accomplishes this through two assumptions: (1) groups of articles on train stations are named in a predictable manner; (2) redirects are cheap. For L-rail to produce the table above, a data module for the system was defined. Before discussing them, however, let's review the parameters:


 * SYSTEM: The company or grouping to which the line belongs. This is case-sensitive and must be consistent. In this case, the value is Amtrak.
 * LINE: The line name. This is also case-sensitive and must be consistent throughout. Here, we're describing the Wolverine.
 * LEFT and RIGHT: The names of the previous and next stations on the line. Current convention suggests West/East Left/Right, followed by North/South, but your mileage may vary. Whenever possible, succession boxes should make geographic sense (i.e. don't have one line running west-east and the other east-west).

You need a module for each system to define the following things: the formatting/linking of the line, the formatting/linking of the left and right stations, the display of the line's color, and the display of the appropriate termini – all automatic.

The data module
The data module needs to be a sub-page of L-rail (Module:L-rail/system). It needs to return a Lua table containing information about the rail system in a hierarchical structure:

Line
The table of a given line should contain the following: