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

edit

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).

Parameter Description Notes
system The system to which the line belongs This should correspond to the title of a subpage of Module:L-rail
line The name of the line
left The name of the previous station, displayed in the left cell
right The name of the next station, displayed in the right cell
typeL The left-hand line branch Optional
typeR The right-hand line branch Optional
note Information about the station itself Optional

Making it work

edit

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):

Lua error in Module:Adjacent_stations at line 237: Unknown line "THSR".

First of all, here's the underlying code:

{{L-rail|system=Taiwan High Speed Rail|line=THSR|left=Taoyuan|right=Miaoli}}

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

edit

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:

Key Value
The string system title System title to be displayed in the header, with wikilink
A line name A table, explained in the next section
Add any number of lines, same as above

Line

edit

The table of a given line should contain the following:

Key Value
The string line title Line title to be displayed in the mid cell, with wikilink
The string colour The colour hex code of the line, displayed in the banner
Example Example
Example Example
Example Example