Difference between revisions of "Template:METRORail"
imported>WOSlinker (tidy style for better HTML5 compatibility) |
imported>WOSlinker (tidy style for better HTML5 compatibility) |
||
| Line 57: | Line 57: | ||
== Extensibility == | == Extensibility == | ||
| − | The template knows that the '''METRORail < | + | The template knows that the '''METRORail <span style="color:red;">Red Line</span>''' goes in a north and south direction. If and when a new line is created, this template can be used for it. All that needs to be done is a simple addition to define the '''previous station direction''' (in this case south) and the '''next station direction''' (in this case north) and the '''color of text that should be used to display the name of the line''' (in this case, red). |
If this arises and you do not feel comfortable editing the code, please contact [[User:Drumguy8800|Drumguy8800]]. | If this arises and you do not feel comfortable editing the code, please contact [[User:Drumguy8800|Drumguy8800]]. | ||
| Line 63: | Line 63: | ||
<includeonly> | <includeonly> | ||
| − | <!-- ERROR MESSAGES FOLLOW -->{{#if: {{{line|}}} | | < | + | <!-- ERROR MESSAGES FOLLOW -->{{#if: {{{line|}}} | | <span style="color:red;">'''There appears to be an error in the way this template was coded.'''</span><br/> <small>There is no line defined (<code>{{!}}line=</code>). Without one, the template cannot know which direction the next stations are. Please fix.</small></br>}}{{#if: {{{prev|}}} | | {{#if: {{{next|}}} | | <span style="color:red;">'''There appears to be an error in the way this template was coded.'''</span><br/> <small>There is no previous station defined (<code>{{!}}prev=</code>) and no next station defined (<code>{{!}}next=</code>). If only a previous station or only a next station defined, the template renders the absent station as a terminus. However, it is highly irregular and highly improbable that there is only one station on a rail line. Please fix.</small></br>}}}}<!-- ACTUAL TEMPLATE CODE FOLLOWS -->{| style="border: 1px solid #CCCCCC; width: 550px; padding:4px;" align="center" cellspacing="0" cellpadding="4px" |
|- | |- | ||
| style="text-align: left; background-color: #f3f3f3;" | {{#if: {{{prev|}}} | '''←''' {{#switch: {{{line|}}} | red | Red = <small>(SOUTH)</small>}} | <small>TERMINUS</small>}} | | style="text-align: left; background-color: #f3f3f3;" | {{#if: {{{prev|}}} | '''←''' {{#switch: {{{line|}}} | red | Red = <small>(SOUTH)</small>}} | <small>TERMINUS</small>}} | ||
Revision as of 10:33, 9 May 2015
| This template employs intricate features of template syntax.
You are encouraged to familiarise yourself with its setup and parser functions before editing the template. If your edit causes unexpected problems, please undo it quickly, as this template may appear on a large number of pages. You can conduct experiments, and should test all major changes, in either this template's sandbox, the general template sandbox, or your user space before changing anything here. |
Contents
How to use
Normal station
Here is how you employ this template with a normal station (one with another station in either direction):
{{METRORail
|line=red
|this=Main Street Square Station
|prev=Bell Station
|next=Preston Station
}}
which creates the following:
| ← (SOUTH) | METRORail Red Line | (NORTH) → |
| Bell Station | Main Street Square Station | Preston Station |
Termini
If you do not define a next or previous station, the template will display "TERMINUS" like so:
{{METRORail
|line=red
|this=Fannin South Station
|next=Reliant Park Station
}}
which creates the following:
| TERMINUS | METRORail Red Line | (NORTH) → |
| None | Fannin South Station | Reliant Park Station |
How this template handles user error
{{METRORail
|this=Fannin South Station
}}
It lets you know when you screw up, like so:
There appears to be an error in the way this template was coded.
There is no line defined (|line=). Without one, the template cannot know which direction the next stations are. Please fix.
There appears to be an error in the way this template was coded.
There is no previous station defined (|prev=) and no next station defined (|next=). If only a previous station or only a next station defined, the template renders the absent station as a terminus. However, it is highly irregular and highly improbable that there is only one station on a rail line. Please fix.
{| style="border: 1px solid #CCCCCC; width: 550px; padding:4px;" align="center" cellspacing="0" cellpadding="4px"
|-
| style="text-align: left; background-color: #f3f3f3;" | TERMINUS
| style="text-align: center; background-color: #f3f3f3;" |METRORail
| style="text-align: right; background-color: #f3f3f3;" |TERMINUS
|-
| style="width: 30%; text-align: left;" | None
| style="width: 40%; text-align: center;" | Fannin South Station
| style="width: 30%; text-align: right;" | None
|}
Extensibility
The template knows that the METRORail Red Line goes in a north and south direction. If and when a new line is created, this template can be used for it. All that needs to be done is a simple addition to define the previous station direction (in this case south) and the next station direction (in this case north) and the color of text that should be used to display the name of the line (in this case, red).
If this arises and you do not feel comfortable editing the code, please contact Drumguy8800.