Template:Tlx

From Official Kodi Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


[edit] Template documentation
Wiki markup Output
{{Tlx|Template|first parameter|second|third|…|tenth}} {{Template|first parameter|second|third|…|tenth}}
{{Tlx|first parameter|…|third|tenth}} {{Template|first parameter|second|third|…|tenth}} if they might contain an equality sign (=)
{{Tlx|Template|<nowiki>first|second|…|999th</nowiki>}} {{Template|first|second|…|999th}} (when you need to show more than ten parameters)

Purpose and naming

Mnemonically 'Template link expanded', after {{Tl}}'s 'Template link'.

This template takes another template's name and some associated pipe-tricked positional parameters (or 'pass parameters'), and displays them as a demonstrative example of how the template could be coded, literally. Its primary use is in instruction and documentation.

  • Specifics: Up to ten pass parameters (numbered or nowiki'd keywords) for the specified template are displayed as 'placeholders', and more than ten parameters can be displayed using a coded vertical-bar (&vert;/&verbar;/&#124;/&VerticalLine;…). A keyword parameter can be used with the equality sign HTML entity (&equals;, &#61; or {{=}} or in nowiki tags: "<nowiki>param=value</nowiki>"; see § Examples below.
  • Exceptions: If the intended template lists numerous parameters, then perhaps this template should really not be used, and just hardcode the usage with <code><nowiki>...</nowiki></code>, for example: <code><nowiki>{{Template|param1=23|size=250px|otherparams…}}</nowiki></code>. 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 <pre>...</pre> tags.

  • If given no additional parameters except the template name, as in {{Tlx|Template name}} or {{Tlx|1=Template name}}, the output is functionally equivalent to the {{Tl}} macro template: a blue hyperlink nested in double braces — the same as a user would apply the template (without parameters) — but with a noticably clearer font and more character spacing on most modern browsers.
    • Comparing the output of the two templates side-by-side: Tl ⇒ {{Template}} versus Tlx ⇒ {{Template}}
  • Comparatively, {{Tl}} 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.
  • {{Tlx}} has a named parameter, |subst=, which when set to any value 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 {{Tlx|Template|subst=y}} will display {{subst:Template}}.

Usage

{{Tlx}} is a generalization of {{Tl|x}}, et cetera, with arguably more readable output. This depends on the browser, but most of them use too narrow a form of {, | and } in conjunction with hyperlinks tend to be hard to read.

Invocation

{{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&vert;more}}
{{Tlx|Template name|param&equals;value}}

Up to 10 placeholders for parameters of the specified template

Examples

Code Result Remark
{{Tlx|Template}} {{Template}}
{{Tlx|Abc}}
{{Tlx|ABC}}
{{Tlx|AbC}}
{{Tlx|Template|one}} {{Template|one}}
{{Tlx|Template|one|two}} {{Template|one|two}}
{{Tlx|Template|1|2|3|4|5|6|7|8|9|10}} {{Template|1|2|3|4|5|6|7|8|9|10}}
{{Tlx|Template|1|2|3|4|5|6|7|8|9|10|11}} {{Template|1|2|3|4|5|6|7|8|9|10|…}} Accepts up to ten parameters, then
{{Tlx|Template|1|2|3|4|5|6|7|8|9|10&#124;11}} {{Template|1|2|3|4|5|6|7|8|9|10|11}} But &#124; instead of the pipe character will let you simulate more
{{Tlx|Template|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} {{Template|14|m|ftin|abbr=out|sp=us}} You can also show an unlimited no. of parameters as a single <nowiki>...</nowiki> string
{{Tlx|Template|x=u}} {{Template}} Trying to show parameters with set values using a normal = won't work
{{Tlx|Template|x&equals;u}} {{Template|x=u}} However, using the HTML entity for the equality sign (&equals; or &#61;) works just fine for that
{{Tlx|Template|x{{=}}u}} {{Template|x=u}} {{=}} costs a few more ms of parser time per page load, but is okay too
{{Tlx|Template|<nowiki>x=u</nowiki>}} {{Template|x=u}} Sticky <nowiki>...</nowiki> is a little messy, but works all the same
{{Tlx|Template| |two}} {{Template|two}} Trying to show an empty positional parameter won't work using just a space
{{Tlx|Template|2=|3=two}} {{Template|two}} Setting a named positional parameter to a null value is sneaky, but doesn't work either
{{Tlx|Template|&nbsp;|two}} {{Template| |two}} But the HTML entity for a non-breaking space (&nbsp;) will get it done
{{Tlx|Template|&#8288;|two}} {{Template|⁠|two}} A true WikiNinja™ will always prefer the invisible Word Joiner character (&#8288;) for that, though
{{Tlx|Template|&vert;two}} {{Template||two}} The HTML entity for a pipe (&vert;/&verbar;/&#124;/&VerticalLine;), though a kludge, looks okay too
{{Tlx|Template|{{!}}two}} {{Template||two}} And speaking of kludges, {{!}} is much worse, since it costs extra parser time on each page load again
{{Tlx|Template|2=one|two}} {{Template|two}} If a named and an unnamed positional parameter end up in a knife fight, the last one supplied always wins
{{Tlx|Template|3=two|2=one}} {{Template|one|two}} The order they're specified in doesn't matter, positional parameters are shown in numerical order by name