Template:Tlx

From TrainzOnline
Revision as of 20:22, 15 June 2013 by Fabartus (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



This '{{{{#if:| }}Tlx{{#if:| | {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}' template documentation is transcluded for all Tlx family templates (Tlx, Tlxc, Tlxw, Tlxb) [edit].{{#ifeq:TrainzOnline|Meta| |Masterpage  }}


Basically:

{{{{#if:Template| }}Tlx{{#if:Template|

| Template }}{{#if:first parameter| | first parameter }}{{#if:second| | second }}{{#if:third| | third }}{{#if:...| | ... }}{{#if:Template| }}}}{{{{#if:first parameter| }}Template{{#if:first parameter| | first parameter }}{{#if:second| | second }}{{#if:third| | third }}{{#if:...| | ... }}{{#if:tenth| | ... }}{{#if:first parameter| }}}} Where parameters might contain "=" characters, use {{{{#if:| }}={{#if:| | {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}} instead

{{{{#if:Template| }}Tlx{{#if:Template|

| Template }}{{#if:first parameter{{=}}anything|second|third{{=}}something|...|tenth| | first parameter{{=}}anything|second|third{{=}}something|...|tenth }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:Template| }}}}{{{{#if:first parameter=anything| }}Template{{#if:first parameter=anything| | first parameter=anything }}{{#if:second| | second }}{{#if:third=something| | third=something }}{{#if:...| | ... }}{{#if:tenth| | ... }}{{#if:first parameter=anything| }}}} For more than 10 parameters, possibly also containing "=", use

{{{{#if:Template| }}Tlx{{#if:Template|

| Template }}{{#if:<nowiki>first|second|third=something|...|999th</nowiki>| | <nowiki>first|second|third=something|...|999th</nowiki> }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:Template| }}}}{{{{#if:first|second|third=something|...|999th| }}Template{{#if:first|second|third=something|...|999th| | first|second|third=something|...|999th }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:first|second|third=something|...|999th| }}}}

The three dots in the examples represent a number of arguments that have been omitted and are not an actual argument.

Purpose and naming

Mnemonically 'Template link expanded'. After <tt>{{{{#if:| }}Tl{{#if:| | {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}</tt> 'Template link'.

  • This template takes another template-name and some associated pipe-tricked (numbered) parameters (or 'pass parameters'), and displays them as an 'example demonstration' of how the template-name template could be coded, literally. Its primary use is in instruction and documentation.
  • Specifics: Up to 10 pass parameters (numbered or nowiki-keywords) for the specified template are displayed as 'placeholders', and over 10 parameters can be displayed using a coded vertical-bar (as in "&#124;..."). A keyword parameter can be used with equals code &#61; or {{=}} or in nowiki-text: "Template:Tag" or all parameters as a string in "Template:Tag" tags; see Examples at bottom. For more details, see this talk page.
  • Exceptions: If the intended template lists numerous parameters, then perhaps this template should really not be used, and just hardcode the usage with Template:TagTemplate:Tag, for example: Template:Tag. If a vertical display, with parameters on their own lines, is desired, this can also be laid out manually in this manner, or more rapidly done with Template:Tag.

  • If given no additional parameters except  'template name' ({{{1}}}),  it presents the same as the similar {{Tl}} macro template -- a blue link nested in curly-braces-- the same as a user would apply the template without parameters, but with a noticably clearer font and spacing on most modern browsers.
  • {{{{#if:Tl| }}Tl{{#if:Tl|

| Tl }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:Tl| }}}} display compared to {{{{#if:Tl| }}Tlx{{#if:Tl| | Tl }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:Tl| }}}}: (Tl: {{Tl}} versus Tlx: {{{{#if:| }}Tl{{#if:| | {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}})

  • Comparatively, {{{{#if:| }}Tl{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}} will not take or display additional parameters, and for minor technical reasons, may be preferred for mere listing and referencing in long pages involving a lot of template expansions.

  • {{{{#if:| }}Tlx{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}} has a named parameter subst. Setting this parameter to any string of length 1 or greater will place the string "subst:" before the template name, linked to Help:Substitution. This is useful to indicate when a template should be substituted. For example {{{{#if:Welcome| }}Tlx{{#if:Welcome| | Welcome }}{{#if:subst=Y| | subst=Y }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:Welcome| }}}} will display {{{{#if:| }}Welcome{{#if:| | {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}.

  • Additionally, Tlx will take a 'named' parameter 'SISTER' to link interwiki to other sister projects such as one of these examples: '|SISTER=W:', 'Tlx|SISTER=M:', 'Tlx|SISTER=Q:', 'Tlx|SISTER=S:', allowing documentation or discourse about a template across interwiki boundaries.

Documentation

{{Tlx}} is a generalization of {{Tl}}, {{Tlp}}, etcetera with arguably better readable output. This depends on the browser, but too narrow uses of "{", "|", "}" in conjunction with links can be hard to read.

Usage

{{Tlx|template name}}
{{Tlx|template name|param}}
{{Tlx|template name|1|2|3|4|5|6|7|8|9|10}}
{{Tlx|template name|1|2|3|4|5|6|7|8|9|10&#124;more}}
{{Tlx|template name|param&#61;value}}

Up to 10 placeholders for parameters of the specified template

Examples

{{#ifeq:TrainzOnline|Wikipedia|| {{#ifeq:TrainzOnline|Meta||

Note
On the source sister projects, en.wikipedia and Meta, X0, X1, X2,..., X9 are sandbox templates for experimentation on involved templates that need be in template space. An auto-cleansing software facility exists that might be used to duplicate the facility on other Sister projects.

}}}}

Code Result Remark
}}Tlx{{#if:x0|

| x0 }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x0| }}}}

}}x0{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

 
}}Tlx{{#if:Abc|

| Abc }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:Abc| }}}}

}}Abc{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

 
}}Tlx{{#if:ABC|

| ABC }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:ABC| }}}}

}}ABC{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

 
}}Tlx{{#if:AbC|

| AbC }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:AbC| }}}}

}}AbC{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

 
}}Tlx{{#if:x1|

| x1 }}{{#if:one| | one }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x1| }}}}

}}x1{{#if:one|

| one }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:one| }}}}

 
}}Tlx{{#if:x2|

| x2 }}{{#if:one| | one }}{{#if:two| | two }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

}}x2{{#if:one|

| one }}{{#if:two| | two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:one| }}}}

 
}}Tlx{{#if:x3|

| x3 }}{{#if:1| | 1 }}{{#if:2| | 2 }}{{#if:3| | 3 }}{{#if:4| | ... }}{{#if:x3| }}}}

}}x3{{#if:1|

| 1 }}{{#if:2| | 2 }}{{#if:3| | 3 }}{{#if:4| | 4 }}{{#if:5| | ... }}{{#if:1| }}}}

 
}}Tlx{{#if:x4|

| x4 }}{{#if:1| | 1 }}{{#if:2| | 2 }}{{#if:3| | 3 }}{{#if:4| | ... }}{{#if:x4| }}}}

}}x4{{#if:1|

| 1 }}{{#if:2| | 2 }}{{#if:3| | 3 }}{{#if:4| | 4 }}{{#if:5| | ... }}{{#if:1| }}}}

up to 10 parameters, then ...
}}Tlx{{#if:x5|

| x5 }}{{#if:1| | 1 }}{{#if:2| | 2 }}{{#if:3| | 3 }}{{#if:4| | ... }}{{#if:x5| }}}}

}}x5{{#if:1|

| 1 }}{{#if:2| | 2 }}{{#if:3| | 3 }}{{#if:4| | 4 }}{{#if:5| | ... }}{{#if:1| }}}}

&#124; for more
{{{{#if:convert| }}Tlx{{#if:convert|

| convert }}{{#if:<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>| | <nowiki>14|m|ftin|abbr=out|sp=us</nowiki> }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:convert| }}}}

unlimited parameters as one nowiki string
}}Tlx{{#if:x1|

| x1 }}{{#if:x=u| | x=u }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x1| }}}}

}}x1{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

= won't work
}}Tlx{{#if:x1|

| x1 }}{{#if:x&#61;u| | x&#61;u }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x1| }}}}

}}x1{{#if:x=u|

| x=u }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x=u| }}}}

&#61; is okay
}}Tlx{{#if:x1|

| x1 }}{{#if:x{{=}}u| | x{{=}}u }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x1| }}}}

}}x1{{#if:x=u|

| x=u }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x=u| }}}}

{{=}} is okay
}}Tlx{{#if:x1|

| x1 }}{{#if:<nowiki>x=u</nowiki>| | <nowiki>x=u</nowiki> }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x1| }}}}

}}x1{{#if:x=u|

| x=u }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x=u| }}}}

sticky nowiki is okay
}}Tlx{{#if:x2|

| x2 }}{{#if: | |   }}{{#if:two| | two }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

}}x2{{#if: |

| }}{{#if:two| | two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if: | }}}}

empty won't work
}}Tlx{{#if:x2|

| x2 }}{{#if:&#32;| | &#32; }}{{#if:two| | two }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

}}x2{{#if: |

| }}{{#if:two| | two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if: | }}}}

&#32; is okay
}}Tlx{{#if:x2|

| x2 }}{{#if:&nbsp;| | &nbsp; }}{{#if:two| | two }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

}}x2{{#if: |

|   }}{{#if:two| | two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if: | }}}}

&nbsp; is okay
}}Tlx{{#if:x2|

| x2 }}{{#if: &#124; two| | &#124; two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

}}x2{{#if: | two|

| | two }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if: | two| }}}}

&#124; is okay
{{{{#if:x2| }}Tlx{{#if:x2|

| x2 }}{{#if: {{!}} two| | {{!}} two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

{{{{#if: | two| }}x2{{#if: | two|

| | two }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if: | two| }}}}

{{{{#if:| }}!{{#if:|

| {{{2}}} }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}} is dubious

{{{{#if:x2| }}Tlx{{#if:x2|

| x2 }}{{#if:2=| | 2= }}{{#if:3=two| | 3=two }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

{{{{#if:| }}x2{{#if:|

| }}{{#if:two| | two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:| }}}}

empty really doesn't work
{{{{#if:x2| }}Tlx{{#if:x2|

| x2 }}{{#if:2=one| | 2=one }}{{#if:two| | two }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

{{{{#if:two| }}x2{{#if:two|

| two }}{{#if:| | {{{3}}} }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:two| }}}}

two clobbers 2=one
{{{{#if:x2| }}Tlx{{#if:x2|

| x2 }}{{#if:3=two| | 3=two }}{{#if:2=one| | 2=one }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:x2| }}}}

{{{{#if:one| }}x2{{#if:one|

| one }}{{#if:two| | two }}{{#if:| | {{{4}}} }}{{#if:| | {{{5}}} }}{{#if:| | ... }}{{#if:one| }}}}

right to left okay

See also

  • Template:Tlxb – same as {{Tlx}}, but gives the template name in boldface type (this can be useful when stressing the difference between two similarly named templates). Template:Tlb is the same, except it uses regular text instead of a monospaced non-proportional font.
  • Template:Temt, – same as {{Tlx}}, but handles template names with the Template: prefix and templates not in the Template: namespace {{ns:10}}.
  • Template:Para – for giving examples of template parameters and values only, instead of entire templates with parameters.

Template:Tl-navde:Vorlage:Vorlage

Contents

 

Personal tools