Template:TR

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

references

Template documentation[edit] [history] [purge]
Purpose

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/references/subpage and Trainz/tags/subpage when given {{{2}}} as the subpage link. Otherwise it connects to each of those parent division pages.

usage

This template forms an internal link to the specified Trainz Books references 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, TOBECONTINUED), 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/references 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/references.
       • {{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 references 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.
Type of data type Typing saver/
(normal modes)
'Direct mode link form modes:',
(GIGO & WYSIWYG in link making)
Comments/Notes
containers
  (Suffix: "{{{2}}} container")
  CON or C   DIRC or DC Use '|3=name' to make section links for the many in-container-tags on a kind
Kinds (plural)
  (Prefix: "KIND {{{2}}}")
  KIND or
  KINDS or K
  KD or DK or
  DIRKIND or DIRK
or container page. (making and appending #{{{3}}} to the group/page links)
tags (singular)
  (Suffix: "{{{2}}} tag")
  TAG1 or T1
  or TAG or T
  TAG3 or T3
  or DIRTAG or DT
NOTE: In practice, most tag/keywords will not have their own page, but instead links will be section links using {{{3}}} to a kind or container page.
tags
  (Suffix: "{{{2}}} tags")
  TAG2 or T2 or TS
  or TAGS or S
  TAG3 or T3 or DIRTAG or DT  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!