Jump to content

Template:TRS

From Wikibooks, open books for an open world

references


Purpose

This template presents a single template to access sub-pages of major Trainz reference 'Tabs' (divisions) (data types defined in TrainzBaseSpec) making a proper link to Trainz/Kinds/subpage, Trainz/refs/subpage and Trainz/tags/subpage when given {{{2}}} 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.

usage

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 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—the reference and normally the source page for the EXPANDED material added in the pages here—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 {{{1}}}) also varies formatting of the displayed link and how the subpage name parameter {{{2}}} is interpreted and manipulated during link formation.

  • In general, if {{{1}}} contains the letter 'D' the template processes {{{2}}} 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' data model 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 if Arg-3's ('|3=...') condition is defined, so '|s=...' need not be used directly.

Parameter2 / Arg-1 Table
Note: The Case of the parameter 1 argument (Arg-1) DOES NOT MATTER. Most often the single letter below is used in pages. If there is no Arg-2, the link will be to the data type's root subpage—usually a list of links to specific related topic pages, a Table of Contents plus overall type technical information.
The type of data this link
formation is targeting
Typing saver/
coded types,
(normal modes)
'Direct mode link form modes:',
(GIGO & WYSIWYG in link making)  (rare modes)
(ONLY one of the two columns at left is used, they are either-or choices, not both.
Comments / Notes 
containers
  (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
  KINDS
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 blue
tags
  (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!

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.

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, {{Template:TRS}} 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.

See also

[edit source]
  • Template:N3V - use instead when want an inline natural language link here on Wikibooks with the same syntax as the target page...

OR...

  • Template:TR2 - The template similar to this one in syntax (actually derivative)— used instead when we don't have a page title here on Wikibooks but can link directly to a page name on the N3V TrainzOnline Wiki (TrainzWiki).