From Wikibooks, open books for an open world
Jump to navigation Jump to search


P train grey.png
2015-0303 Notice: some of the longer mode parameter names have been trimmed from the working template.
Use short ones, and if you have the time feel free to update the usage to match the coded template! FrankB 23:43, 3 March 2015 (UTC)
Template documentation[edit] [history] [purge]

This template presents a single template to access sub-pages of major Trainz reference 'Tabs' (divisions) making a proper link to Trainz/Kinds/subpage, Trainz/refs/subpage and Trainz/tags/subpage when given {{{2}}} as the subpage link. Otherwise it connects to each of those parent division pages.


This template forms an internal link to the specified Trainz Books refs pages (Wikibook sub-pages or Chapters) (with the case-insensitive controlling parameter {{{1}}} being used to switch which chapter and table of contents is being selected.  

The first parameter ('1' or {{{1}}}) also varies formatting of the displayed link and how the subpage name parameter {{{2}}} is interpreted during link formation.

  • In general, if {{{1}}} contains the letter 'D' the template processes {{{2}}} as a 'literal' or 'direct link' case, and otherwise (no 'd' or 'D' in '1')... will append suffixed keywords tag, container, or prefix KIND to the keyword.


  • These forms correspond directly to the same page names as pages in the TrainzOnline Wiki main namespace—the reference and normally the source page for the EXPANDED material added in the pages here.

Linking externally
  • The one deviation is we always omit the encapsulating quote marks and link to the N3V wiki to any apropos redirect page title instead -- that is a page without paired quotes in the name... Note the Template: N3V may be used to make a direct link to ANY OF the N3V wiki namespace pages--given a partial url (interim, TOBE CONTINUED), and Template:Plain link will take any url and connect to a web page given a full URL.


  • The template also handles certain singular or plural suffixing on the pass parameter. Experience shows that if the page exists, the link needs must be the other form. So for example if the page is an important tag keyword, and {{TR|T|tag-name}} is a redlink, try {{TR|S|tagname}} or {{TR|TS... or {{TR|ST... }}, each being valid '1' placeholder parameter values handled by the template logic for class tags.


For any class data case, link formation may also contain a section title. This is specified by defining one of the explicit parameters 'sect', 's', or 'sect' and these must be lower case. ( 's' != 'S', nor does SECT equate to sect).

Detailed usage
  1. When the {{{1}}} parameter is undefined, the template links to the Trainz/refs page which holds the reference pages Table of Contents. This link is shown above this usage as most of the template becomes irrelevant (vaporware!).
  2. In implementation, to make this template serve as many uses as possible, this style template operates slightly differently than a direct linking template:
    1. Those that append or Prefix a key word (suffix==container while KIND==prefix, and the tags are suffixed either tag or tags) also have a direct mode for passing the full spelling of their string. (See table under, containers, Kinds, and Tags only.)
  3. {{{1}}} has these legal values and forms the matching links:
    1. '|CON|C=' selects the page Trainz/containers (TOC) or one of it's sub-pages by building a link
      [[ Trainz/containers/{{{2}}} container#3| {{{3|{{{2|}}} container}}} ]] ? (a space+container added as suffix)
       • The #3 represents a logical test to see if {{{3}}} pass parameter is defined, and if so, appends it as a section link to a anchor or section title (tags on kind and containers pages have sections detailing their scope and use) as part of the link.
       • As always with section linking, the {{{3}}} parameter must use underscores for spaces.
       • For the benefit of those less familiar with template parsing, will form a link to the page addressed. In this example, to the 'References TOC notations' section of Trainz/refs.
       • {{Col|While not shown again, the {{{3}}} parameter is tested and appended when defined to all links formed by any and all of the following options as well.
    2. '|KD|DK= (kind's 'direct mode') selects the page [[Trainz/Kinds/{{{2|}}}#3|{{{3|{{{2|}}}}}} ]] (TOC) or one of it's sub-pages by building a link
      [[ Trainz/Kinds/KIND {{{2}}}|{{{3| KIND {{{2|}}}}}} ]]
       • #3 is as advertised...
    3. '|KIND|K|KINDS= selects the page Trainz/Kinds (TOC) or one of it's sub-pages by building a link
      [[ Trainz/Kinds/KIND {{{2}}}| KIND {{{3|{{{2|}}}}}} ]]
    4. '|L|DIR|DIRECT= selects the page
      [[Trainz/{{{2}}}|{{{3|{{{2|}}}}}} ]] (the Main / TOC page) or one of it's sub-pages in the same way.
    5. Similarly, '|A|AM|AM&C= selects the page
      [[Trainz/AM&C/{{{2}}}|{{{3|{{{2|}}}}}} ]] (the AM&C / TOC page) or one of it's sub-pages in the same way.
    6. Similarly, '|CC= selects the page
      [[Trainz/content Creation/{{{2}}}|{{{3|{{{2|}}}}}} ]] (the Content Creation TOC page) or one of it's sub-pages in the same way.
    7. '|TAG1|T1|T=' selects the page Trainz/tags (Sub-TOC) or one of it's sub-pages by building a link
      [[ Trainz/tags/{{{2}}} tag#3| {{{3|{{{2|}}} tag}}} ]]
    8. Similarly, '|ST|S|TS|TAGS|T2= selects the page a
      [[Trainz/tags/{{{2}}}|{{{3|{{{2|}}} tags}}} ]] (the same sub-TOC page) or one of it's sub-pages in the same way, but suffix is plural, which names end with 'S'.
  • Likely Reference 'chapters' (major Sub-TOC's and topic groups) as currently schemed/expected (in mid-May 2014) are:
    /Appendixes, /tags, /containers, Kinds, /Scenery, /Scripting, /Splines, /Tracks, /Trackside, etc. (partial and conjectural) As of mid-August, only Kinds, tags, and containers have any population pages.
IN ALL Cases, including the below the parameter '|p=' so (p=pretty-name) forms a over-riding 'pretty name' for display of the desired link-to-page of the 'Trainz refs division' of the Trainz Wikibook projects.

In-line Examples:

  • {{TR|DC|queues container}} links as if written:
[[Trainz/containers/queues container]] and the actual link and display
generated is: queues container shows this mode.
  • Similarly to link a sub-section:
{{TR|DC|queues|custom-attachments}} links as if written:
[[Trainz/containers/queues container#custom-attachments|custom-attachments]] and the link
displays only: custom-attachments
But! ... is much easier to edit around on a page when trying to get the best prose presentation.
Note: Case of parameter argument (Arg-1) DOES NOT MATTER
Type of data type Typing saver/
(normal modes)
'Direct mode link form modes:',
(GIGO & WYSIWYG in link making)
  (Suffix: "{{{2}}} container")
  CON or C   DIRC or DC Use '| s= or {{{3}}}name' to make section links for the many in-container-tags on a kind.
Kinds (plural)
  (Prefix: "KIND {{{2}}}")
  KIND or
  KIND or K
  KD or DK or
or container page. (making and appending #{{{3}}} to the group/page links)
tags (singular)
  (Suffix: "{{{2}}} tag")
  TAG or T   TD or DT NOTE: In practice, most tag/keywords will not have their own page, but instead links will be section links' using {{{s}}} (''
  (Suffix: "{{{2}}} tags")
  ST or TS or S   TD or DT or TAGS  In the placeholder parameter '2' (|2=) control, using 'T' is mnemonically preferable to both 'S' or 'TS' so tag pages, when warranted and created, should be singular case!