Template:TR/doc

This template presents a single template to access sub-pages of major Trainz reference 'Tabs' (divisions) (data types defined in ) making a proper link to Trainz/Kinds/subpage, Trainz/refs/subpage and Trainz/tags/subpage when given  as the page title of a subpage link. Otherwise it connects to each of those class subpage's parent (book division) pages in Trainz/refs.
 * Purpose

This template forms an internal link to the specified Trainz Books pages (Wikibook sub-pages or Chapters) (with the case-insensitive   being used to switch which chapter and table of contents is being selected.
 * usage
 * The name forms linked by this template do not correspond directly to the syntactically exact same page names as pages in the TrainzOnline Wiki main namespace&mdash;the reference and normally the source page for the EXPANDED material added in the pages here&mdash;because the Wikibook topics do not contain either inappropriate capitalization nor punctuation of key-word phrases enumerated in the Trainz data model. In short this template makes links to page titles exactly matching the error-free expectations of the Trainz run-time and fault checking software. This prevents confusion, we think.

The second (control mode) parameter ('|1' or ) also varies formatting of the displayed link and how the   is interpreted and manipulated during link formation.
 * In general, if  contains   the template processes   as a 'literal' or 'direct link' cases... by which is meant Arg-2 is given as the direct sub-page name, so suffixing or prefixing is NOT APPLIED.


 * otherwise (no 'd' or 'D' in 'Arg-2')... will append suffixed keywords _tag, _container, or prefix KIND_ to the keyword along with other formatting to make a proper subpage title here on Wikibooks.


 * Unlike the clumsy design of the N3V Wiki tag name corresponding page titles here on the wikibook precisely match the case and syntax of Trainz' enumerated tag names for each kind or container, and Template:TR is primarily designed to form such links to the appropriate subpage on the topic. Use of this template thus eliminates the inaccurate capitalization of terms and used of quotes embedded in others allowing the precise matching of data model acceptable names and minimizing confusions of either altered name forms of the N3V Wiki.


 * As with most Trainz Wikibook templates, both a section link ('s=...') and pretty-print ('p=...') output override parameter are available. As a default, a section title and the processing for such also occur condition is defined, so '|s=...' need not be used directly.

Note: The template with no third parameter, will form a link to the root subpage of the data type, so is useful to provide a quick link for readers to be able to review general data and a list of peers of the type since those root pages also act as type TOC (index) pages with links to members.
 * Parameter2 / Arg-1 Table
 * 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 is a redlink, try  or {{TR|TS... or {{TR|ST... }}, each being valid '1' placeholder parameter values handled by the template logic for class tags.

{{TextBox|1=For any class data case, link formation may also contain a section title. This is specified by defining one of the explicit parameters  and these must be lower case. ( 's' != 'S', nor does SECT equate to sect). }} }} The {{Col|{{sup|#3}} represents a logical test|blue}} to see if  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.{{BullR }} As always with section linking, the parameter {{col|must use underscores}} for spaces.{{BullR}}For the benefit of those less familiar with template parsing, {{Tlx|3=References_TOC_notations}} will form a link to the page addressed. In this example, to the 'References TOC notations' section of Trainz/refs.{{BullR }} {{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.
 * 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:
 * 3) 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.)
 * 4)   has these legal values and forms the matching links:
 * 5) {{Col| '|CON|C=' |blue}} selects the page Trainz/containers (TOC) or one of it's sub-pages by building a link  ? (a space+container added as suffix) {{bullR
 * 1) {{Col| '|KD|DK= |blue}} (kind's 'direct mode') selects the page }}} {{Col|{{sup|#3}}|blue}} |{{{3|{{{2|}}}}}}  (TOC) or one of it's sub-pages by building a link {{bullR}}{{Col|{{sup|#3}}|blue}} is as advertised...
 * 2) {{Col| '|KIND|K|KINDS= |blue}} selects the page Trainz/Kinds (TOC) or one of it's sub-pages by building a link
 * 3) {{Col| '|L|DIR|DIRECT= |blue}} selects the page  (the Main / TOC page) or one of it's sub-pages in the same way.
 * 4) Similarly, {{Col| '|A|AM|AM&C= |blue}} selects the page  (the {{TA}} / TOC page) or one of it's sub-pages in the same way.
 * 5) Similarly, {{Col| '|CC= |blue}} selects the page  (the {{TC|}} TOC page) or one of it's sub-pages in the same way.
 * 6) {{Col| '|TAG1|T1|T=' |blue}} selects the page   (Sub-TOC) or one of it's sub-pages by building a link
 * 7) Similarly, {{Col| '|ST|S|TS|TAGS|T2= |blue}} selects the page a  (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 ) as currently schemed/expected (in mid-May 2014) are:  etc. (partial and conjectural) As of mid-August, only Kinds, tags, and containers have any population pages.

{{TextBox|1=
 * IN ALL Cases, including the below the parameter ' |p= ' so {{col|( p= pretty-name)|blue}} forms a over-riding 'pretty name' for display of the desired link-to-page of the 'Trainz refs division' of the Trainz Wikibook projects.
 * It is in fact the case for all Trainz linking templates by design.

}}  In-line Examples :
 * {{TR|DC|queues container}} links as if written:
 * and the actual link and display
 * generated is:  shows this mode.


 * Similarly to link a sub-section:
 * links as if written:
 * and the link
 * displays only:
 * But! ... is much easier to edit around on a page when trying to get the best prose presentation.