Module
TransportDiagram/doc
From Dogcraft Wiki
No edit summary |
No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 9: | Line 9: | ||
track: STN NS, track-type: ORM, station: [[#Content rules|Content rules]], track2: ITC S, track2-type: CRN, station2: [[#Examples|Examples]] | track: STN NS, track-type: ORM, station: [[#Content rules|Content rules]], track2: ITC S, track2-type: CRN, station2: [[#Examples|Examples]] | ||
track: STN NS, track-type: ORM, station: [[#Error handling|Error handling]], track2: STN NS, track2-type: CRN, station2: [[#Ouranos Metro|Ouranos Metro]] | track: STN NS, track-type: ORM, station: [[#Error handling|Error handling]], track2: STN NS, track2-type: CRN, station2: [[#Ouranos Metro|Ouranos Metro]] | ||
track: ITC N, track-type: ORM, station: [[#Template closer|Template closer]], track2: STN | track: ITC N, track-type: ORM, station: [[#Template closer|Template closer]], track2: STN N, track2-type: CRN, station2: [[#West Line (Survival 3)|Survival 3 West Line]]}} | ||
'''< | '''<nowiki>{{TransportDiagram}}</nowiki>''' is a template that uses [[Module:TransportDiagram]] to produce diagrams of transport networks on the [[Dogcraft Server]]. The module accepts a simple line-by-line parameter-based markup to produce the diagrams. | ||
This template is not for making geographically accurate maps, but rather handy navigational templates and should be used instead of cumbersome lists for navigating between popular station articles, although note this map is primarily designed for use with railway or railway-style transit infrastructure, so may not be appropriate in all settings. Different networks will require different icons. | This template is not for making geographically accurate maps, but rather handy navigational templates and should be used instead of cumbersome lists for navigating between popular station articles, although note this map is primarily designed for use with railway or railway-style transit infrastructure, so may not be appropriate in all settings. Different networks will require different icons. | ||
Line 60: | Line 60: | ||
'''Track and station properties''' | '''Track and station properties''' | ||
* <code>track[n]</code> - ''string'', where <code>[n]</code> in the key optionally specifies the track column (1-4, from left to right), though is not required and defaults to 1. - Determines the visual appearance of the track on that column; the icon that is to be used. See below for a list of possible icons that can be used for this property. | * <code>track[n]</code> - ''string'', where <code>[n]</code> in the key optionally specifies the track column (1-4, from left to right), though is not required and defaults to 1. - Determines the visual appearance of the track on that column; the icon that is to be used. See below for a list of possible icons that can be used for this property. | ||
* <code>track[n]-type</code> - ''string,'' where <code>[n]</code> in the key optionally specifies the track column (1-4, from left to right), though is not required and defaults to 1. - Controls the color of the track to be used, conforming to the branding color of the associated network (e.g. SRN for [[Survival Railway Network]]). This is partly used in selecting the icon that will appear for the track. See below for a list of the available track types. | * <code>track[n]-type</code> - ''string,'' where <code>[n]</code> in the key optionally specifies the track column (1-4, from left to right), though is not required and defaults to 1. - Controls the color of the track to be used, conforming to the branding color of the associated network (e.g. SRN for [[Survival Railway Network]]). This is partly used in selecting the icon that will appear for the track. See below for a list of the available track types. If this parameter is not specified, the default for the first track is <code>SRN</code>, followed by <code>SRB</code> for columns 2, 3 and 4. | ||
* <code>station</code> - ''string'' - The wikitext to display to the left of the first track column on this row, indicating a station or annotation about the adjacent icons. (e.g. [[Ouranos Station]]) | * <code>station</code> - ''string'' - The wikitext to display to the left of the first track column on this row, indicating a station or annotation about the adjacent icons. (e.g. [[Ouranos Station]]) | ||
* <code>station2</code> or <code>station-right</code> - ''string'' - The wikitext to display to the right of the last track column on this row, indicating a station or annotation about the adjacent icons. | * <code>station2</code> or <code>station-right</code> - ''string'' - The wikitext to display to the right of the last track column on this row, indicating a station or annotation about the adjacent icons. | ||
Line 74: | Line 74: | ||
* <code>SRB</code> - Aqua - Survival Railway Network branch lines | * <code>SRB</code> - Aqua - Survival Railway Network branch lines | ||
* <code>CRN</code> - Red - [[Community Rail Network]] main lines | * <code>CRN</code> - Red - [[Community Rail Network]] main lines | ||
* <code> | * <code>ORM</code> - Green - The [[Ouranos Metro]] | ||
'''Track images''' (<code>track[n]</code> | '''Track images''' (<code>track[n]</code>) | ||
Track icon image file names are formatted as follows: | Track icon image file names are formatted as follows: | ||
* 3-letter piece code, capitalized | * 3-letter piece code, capitalized |
Latest revision as of 16:10, 4 October 2022
{{TransportDiagram}} is a template that uses Module:TransportDiagram to produce diagrams of transport networks on the Dogcraft Server. The module accepts a simple line-by-line parameter-based markup to produce the diagrams.
This template is not for making geographically accurate maps, but rather handy navigational templates and should be used instead of cumbersome lists for navigating between popular station articles, although note this map is primarily designed for use with railway or railway-style transit infrastructure, so may not be appropriate in all settings. Different networks will require different icons.
Specification
A TransportDiagram can be used with the following specification. It is important to note that this template only accepts one parameter; a text block of special Dogcraft Wiki TransportDiagram markup.
Template opener
Open a TransportDiagram template with the template identifer: {{TransportDiagram|
TransportDiagram Markup
The markup accepted by a TransportDiagram is formatted as described below. Please note that while TransportDiagram markup is whitespace insignificant, line terminators (\n) are considered significant and should not be used.
Rows
Markup is parsed line-by-line to generate each row of tracks. To separate two lines, use a simple newline return (ENTER ⏎
).
A TransportDiagram is structured with the following rows: 1. Header (0-1) 2. Track and station rows (0-999)
Empty rows will be skipped. For example, the following four lines will be parsed as three rows, with the third line being skipped:
property: value, property2: value, property3: value property: value, property2: value, property3: value property: value, property2: value, property3: value
Property format
Each line, or row, of TransportDiagram markup is comprised by a series of comma-separated (,
) parameters, which themselves are key-value pairs delimited by colons (:
).
Example row: property: value, property2: foo bar, property3: foo la la
Property keys and values can contain any character, except exclamation points, commas, colons and exclamation points (used for delimitation).
Header row
The first row should, by convention, specify metadata about the template display, including the title and number of parallel tracks.
Header properties:
diagram-title
ortitle
- string - The title of the diagram (e.g. "East Station"). Can contain wiki markup, including [[Links]]diagram-tracks
ortracks
- integer - The number of tracks to display, inclusively between 1 and 4;1 >= n <= 4
Track and station rows
Every row after the first should contain track and station data.
Note that TransportDiagrams can have between one and four track columns inclusively. This means that each row can display up to four track icons. If you are using more than one column, you must remember to specify the diagram-tracks
property in the header row, otherwise columns beyond the first one will not appear.
Track and station properties
track[n]
- string, where[n]
in the key optionally specifies the track column (1-4, from left to right), though is not required and defaults to 1. - Determines the visual appearance of the track on that column; the icon that is to be used. See below for a list of possible icons that can be used for this property.track[n]-type
- string, where[n]
in the key optionally specifies the track column (1-4, from left to right), though is not required and defaults to 1. - Controls the color of the track to be used, conforming to the branding color of the associated network (e.g. SRN for Survival Railway Network). This is partly used in selecting the icon that will appear for the track. See below for a list of the available track types. If this parameter is not specified, the default for the first track isSRN
, followed bySRB
for columns 2, 3 and 4.station
- string - The wikitext to display to the left of the first track column on this row, indicating a station or annotation about the adjacent icons. (e.g. Ouranos Station)station2
orstation-right
- string - The wikitext to display to the right of the last track column on this row, indicating a station or annotation about the adjacent icons.
If no valid station data properties are present on a row, it will be ignored. At a bare minimum, one valid track item is required to generate a row.
Track icons
There are 25 track icons in total, the color of which is determined by the track[n]-type
property and the shape of which is determined by the track[n]
property.
Track types (track[n]-type
):
The following track types are available for each network project (case sensitive).
SRN
- Yellow - Survival Railway Network main linesSRB
- Aqua - Survival Railway Network branch linesCRN
- Red - Community Rail Network main linesORM
- Green - The Ouranos Metro
Track images (track[n]
)
Track icon image file names are formatted as follows:
- 3-letter piece code, capitalized
- (underscore or blank space)
- 0-2 letter track directions, capitalized. If the piece has track exiting the top, this is
N
. If the piece has track exiting the bottom, this isS
. If the piece has track exiting the top and bottom, this isNS
. - (underscore or blank space, if track augmentations need to be specified)
- 0-3 letter track augmentations. The only current augmentation is a connection augmentation, represented by
C
; if a track connects to an adjacent piece to the right, this is EC (East Connection). If a track connects to an adjacent piece to the left, this is WC (West Connection). If this track is a middle-piece that connects to pieces on both the left and right, this is EWC (East, West Connection).
Icon display | Piece code | Piece type | Track directions | Track augmentations |
---|---|---|---|---|
TRK NS |
Track | North, South | - | |
STN S |
Station | South | - | |
STN N |
Station | North | - | |
STN NS |
Station | North, South | - | |
ITC S |
Interchange | South | - | |
ITC N |
Interchange | North | - | |
ITC NS |
Interchange | North, South | - | |
ITC S EC |
Interchange | South | East Connection | |
ITC S WC |
Interchange | South | West Connection | |
ITC S EWC |
Interchange | South | East, West Connection | |
ITC N EC |
Interchange | North | East Connection | |
ITC N WC |
Interchange | North | West Connection | |
ITC N EWC |
Interchange | North | East, West Connection | |
ITC NS EC |
Interchange | North, South | East Connection | |
ITC NS WC |
Interchange | North, South | West Connection | |
ITC NS EWC |
Interchange | North, South | East, West Connection | |
ITC EWC |
Interchange | - | East, West Connection | |
JNC WC |
Junction | (not required) | West Connection | |
JNC EC |
Junction | (not required) | East Connection | |
CRN N EC |
Corner | North | East Connection | |
CRN S EC |
Corner | South | East Connection | |
CRN N WC |
Corner | North | West Connection | |
CRN S WC |
Corner | South | West Connection | |
CNT S |
Continuity | South | - | |
CNT N |
Continuity | North | - |
Content rules
Please note that the equals sign (=) and exclamation mark (!) must not be used within the template markup data. Duly also note that templates are resolved and substituted before being passed into the backend lua module that powers this template. It is possible to pass escaped wikitext markup, such as special words, however, to work around this.
Error handling
Using invalid properties will silently fail as they will not be read. Using invalid characters will return a lua error in place of the template.
Template closer
Don't forget to close a TransportDiagram with two curly braces: }}
Examples
Below are some valid examples of TemplateDiagrams in action.
Ouranos Metro
The Ouranos Metro map was used to help plan this specification. It's a simple short network but demonstrates the versatility of the diagrams in representing different modes of travel.
{{TransportDiagram| diagram-title: Ouranos Metro, diagram-tracks: 2 track-type: ORM, track: STN S, station: Castle Station, track2: CNT N, track2-type: SRB, station2: ''to [[Cool Cove Station|Cool Cove]] ([[Survival Railway Network (Survival 3)|SRN]])'' track-type: ORM, track: ITC NS EC, station: Central Station, track2: ITC N WC, track2-type: SRB track-type: ORM, track: STN NS, station: [[The Chase|Theatre Station]] track-type: ORM, track: STN NS, station: East Gate Station track-type: ORM, track: ITC N, station: Raceway Station }}
West Line (Survival 3)
The West Line on the Survival 3 SRN is one of the most complex lines to have been built and utilities three of the four available columns to display it, in full (with exception to the Avalanche line). Below is the markup that makes it work.
{{TransportDiagram| diagram-title: West Line (Survival 3), diagram-tracks: 3 track: ITC S, station: [[Grand Central Station (Survival 3)|Grand Central]] track: ITC NS, station: [[Mall Station (Survival 3)|Mall Station]] track: ITC NS, station: [[Balaton Station]] track: TRK NS, track3: ITC S, station2: ''Wolfhaven Station'' track: TRK NS, track3: ITC NS, station2: ''Snowfields Station'' track: ITC NS EC, station: [[Bastion Glace Station|Bastion Glace]], track2: ITC EWC, track3: ITC NS WC track: TRK NS, track3: ITC NS, station2: ''Everec Station'' track: TRK NS, track2: CNT N, track3: TRK NS, station: ''to the [[Avalanche Branch Line|Avalanche Line]]'' track: TRK NS, track2: TRK NS, track3: ITC NS, station2: ''Wilder Station'' track: ITC NS EC, station: [[Relleka Station]], track2: ITC NS WC, track3: TRK NS track: TRK NS, track2: ITC NS, track3: TRK NS, station: ''Jello Station'' track: TRK NS, track2: ITC NS EC, track3: ITC NS WC, station2: ''Meander Station'' track: TRK NS, track2: TRK NS, track3: ITC NS, station2: ''Cantina Station'' track: TRK NS, track2: ITC NS, track3: TRK NS, station: ''Cloud Station'' track: TRK NS, track2: TRK NS, track3: ITC NS, station2: ''[[Build Battles]]'' track: TRK NS, track2: ITC NS, track3: TRK NS, station: ''Edgecliff Station'' track: TRK NS, track2: TRK NS, track3: ITC N, station2: ''Aeghu's Station'' track: TRK NS, track2: ITC NS, station: ''[[Cyberdog Safaris|Safari Station]]'' track: TRK NS, track2: ITC N, station: ''[[Ratanga Junction]]'' track: ITC N, station: [[The Rock Station|The Rock]] }}