Difference between revisions of "Template:METRORail"
imported>Drumguy8800 m (cleanup) |
imported>Yobot m (→Extensibility: Fix broken break tag, replaced: </br> → <br> (2) using AWB) |
||
| (8 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
| − | {| style="border: 1px solid #CCCCCC; width: 550px; padding:4px;" align="center" cellspacing="0" cellpadding="4px" | + | <noinclude> |
| + | {{esoteric}} | ||
| + | |||
| + | == How to use == | ||
| + | === Normal station === | ||
| + | Here is how you employ this template with a normal station (one with another station in either direction): | ||
| + | |||
| + | <div style="width:350px;background:#dddddd;border: 1px solid black;padding:0.5em 1em 0.5em 1em"><pre> | ||
| + | {{METRORail | ||
| + | |line=red | ||
| + | |this=Main Street Square Station | ||
| + | |prev=Bell Station | ||
| + | |next=Preston Station | ||
| + | }} | ||
| + | </pre></div> | ||
| + | |||
| + | which creates the following: | ||
| + | |||
| + | {{METRORail | ||
| + | |line=red | ||
| + | |this=Main Street Square Station | ||
| + | |prev=Bell Station | ||
| + | |next=Preston Station | ||
| + | }} | ||
| + | |||
| + | === Termini === | ||
| + | If you do not define a next or previous station, the template will display "TERMINUS" like so: | ||
| + | |||
| + | <div style="width:350px;background:#dddddd;border: 1px solid black;padding:0.5em 1em 0.5em 1em"><pre> | ||
| + | {{METRORail | ||
| + | |line=red | ||
| + | |this=Fannin South Station | ||
| + | |next=Reliant Park Station | ||
| + | }} | ||
| + | </pre></div> | ||
| + | |||
| + | which creates the following: | ||
| + | |||
| + | {{METRORail | ||
| + | |line=red | ||
| + | |this=Fannin South Station | ||
| + | |next=Reliant Park Station | ||
| + | }} | ||
| + | |||
| + | === How this template handles user error === | ||
| + | <div style="width:350px;background:#dddddd;border: 1px solid black;padding:0.5em 1em 0.5em 1em"><pre> | ||
| + | {{METRORail | ||
| + | |this=Fannin South Station | ||
| + | }} | ||
| + | </pre></div> | ||
| + | |||
| + | It lets you know when you screw up, like so: | ||
| + | |||
| + | {{METRORail | ||
| + | |this=Fannin South Station | ||
| + | }} | ||
| + | |||
| + | == Extensibility == | ||
| + | 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]]. | ||
| + | </noinclude> | ||
| + | |||
| + | <includeonly> | ||
| + | <!-- 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>}} | ||
| − | | style="text-align: center; background-color: #f3f3f3;" |'''[[METRORail]]''' {{#switch: {{{line|}}} | red | Red = ''' | + | | style="text-align: center; background-color: #f3f3f3;" |'''[[METRORail]]''' {{#switch: {{{line|}}} | red | Red = '''[[METRORail#Red_Line_(2004)|<span style="color:red;">Red Line</span>]]'''}} |
| style="text-align: right; background-color: #f3f3f3;" |{{#if: {{{next|}}} | {{#switch: {{{line|}}} | red | Red = <small>(NORTH)</small>}} '''→''' | <small>TERMINUS</small>}} | | style="text-align: right; background-color: #f3f3f3;" |{{#if: {{{next|}}} | {{#switch: {{{line|}}} | red | Red = <small>(NORTH)</small>}} '''→''' | <small>TERMINUS</small>}} | ||
|- | |- | ||
| Line 8: | Line 72: | ||
| style="width: 40%; text-align: center;" | '''{{{this}}}''' | | style="width: 40%; text-align: center;" | '''{{{this}}}''' | ||
| style="width: 30%; text-align: right;" | {{#if: {{{next|}}} | '''[[{{{next}}}]]''' | '''None''' }} | | style="width: 30%; text-align: right;" | {{#if: {{{next|}}} | '''[[{{{next}}}]]''' | '''None''' }} | ||
| − | |} | + | |}</includeonly> |
Latest revision as of 23:15, 4 October 2016
| 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.