Template:Tlx/doc: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
Add documentation on subst named parameter. Copyedit. Remove badly formatted reference with no obvious relevance to discussion.
RogueScholar (talk | contribs)
m Attempt to clear duplicate parameter tracking category
 
(59 intermediate revisions by 36 users not shown)
Line 1: Line 1:
<includeonly><!-----------------Interwiki Doc page pattern------------------->
{| style="margin: 1.5em auto; width: fit-content;"
<small>''This '{{Tlx|Tlx}}' template documentation is [[w:Wikipedia:Template doc page pattern|transcluded]] for all ''Tlx family templates (Tlx, Tlxc, Tlxm, Tlxw)'' [<span class="plainlinks">[{{fullurl:Template:Tlx/doc |action=edit}} edit]</span>].{{#ifeq:{{SITENAME}}|Meta|&nbsp;|[[M:template:{{PAGENAMEE}}|Masterpage]]
! colspan="2" scope="col" | Wiki markup
&nbsp;}}</small></includeonly><noinclude>  
! scope="col" | Output
{{template doc page viewed directly}}
|-
{{-}}
| style="text-align: right;" | <kbd><nowiki>{{Tlx|Template|first parameter|second|third||tenth}}</nowiki></kbd>
{{interwikitmp-grp
| ⇒
|V=D
| {{Tlx|Template|first parameter|second|third||tenth}}
|cats=
|-
|inhib=yes
| style="text-align: right;" | <kbd><nowiki>{{Tlx|first parameter||third|tenth}}</nowiki></kbd>
|wdy=|wqt=|wsr=|wnw=
| ⇒
|{{PAGENAME}}|{{PAGENAME}}}}</noinclude>
| {{Tlx|Template|first parameter|second|third||tenth}} if they might contain an equality sign (<code>=</code>)
 
|-
<!-- Parent template(s) usage Begins: --->
| style="text-align: right;" | <kbd><nowiki>{{Tlx|Template|&lt;nowiki>first|second|…|999th&lt;/nowiki>}}</nowiki></pre>
<includeonly>{{interwikitmp-grp|V=6|cat=Typing-aid templates |CATS=[[Category:Internal link templates|Tlx]][[Category:Interwiki link templates|Tlx]]}}</includeonly>
| ⇒
 
| {{Tlx|Template|<nowiki>first|second||999th</nowiki>}} (when you need to show more than ten parameters)
{{tlx|tlx|template|first parameter|second|third|fourth|fifth|sixth|seventh|eight|ninth}} → {{tlx|template|first parameter|second|third|fourth|fifth|sixth|seventh|eight|ninth}}
|}
 
== Purpose and naming ==
==Purpose and naming==
[[wikt:mnemonic|Mnemonically]] ''''T'''emplate '''l'''ink e'''x'''panded', after {{Tlx|Tl}}'s ''''T'''emplate '''l'''ink'.
[[Wikt:mnemonic|Mnemonically]] ''''T'''emplate '''l'''ink e'''x'''panded'... after <tt>{{tlx|tl}}</tt> '''T'''emplate '''l'''ink'  
 
* This template takes another ''template-name'' and some associated [[w:pipe-trick|pipe-tricked]]  [http://meta.wikimedia.org/wiki/Parameter#Parameters (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 five pass parameters (numbered or nowiki-keywords) for the specified template are displayed as 'placeholders', and over 5 parameters can be displayed using a coded vertical-bar (as in "<small>&amp;#124;</small>''...''"). A keyword parameter can be used, when tagged as a nowiki-keyword: <nowiki>"<nowiki>siz=10<\nowiki>"</nowiki> with each keyword parameter surrounded by <nowiki>"<nowiki>"</nowiki> tags; see ''[[#Examples|Examples]]'' at bottom. For more details, see the [[w:{{TALKPAGENAME}}|this talk]] page.
* '''''Exceptions:''''' If the intended template lists numerous/keyword parameters, then perhaps this template should really ''not'' be used, and just hardcode the usage with <code><nowiki>&lt;code&gt;&lt;nowiki&gt;</code>, for example: <code><nowiki>&lt;code&gt;&lt;nowiki&gt;{{Anytemplate|arg1=23|siz=250px|</nowiki><var>other parameters...</var><nowiki>}}&lt;/nowiki&gt;&lt;/code&gt;</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 <code><nowiki><pre>...</pre></nowiki></code>.
 
----


* If given no additional parameters except ''<code>&nbsp;'template&nbsp;name'&nbsp;(<nowiki>{{{1}}}</nowiki>), </code>''&nbsp;it presents the same as the similar {{tl|Tl}} [[W:macro|macro]] template -- a blue link nested in [[W:brackets|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.  
This template takes another template's name and some associated [[wikipedia:Help:Pipe trick|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 (<code>&amp;vert;</code>/<code>&amp;verbar;</code>/<code>&amp;#124;</code>/<code>&amp;VerticalLine;…</code>). A keyword parameter can be used with the equality sign HTML entity (<code>&amp;equals;</code>, <code>&amp;#61;</code> or <code><nowiki>{{=}}</nowiki></code> or in nowiki tags: "&lt;nowiki>param=<var>value</var>&lt;/nowiki>"; see ''[[#Examples|§ 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 {{Tag|code|content={{Tag|nowiki|style=plain}}}}, for example: {{Tag|code|content={{Tag|nowiki|style=plain|content=<nowiki>{{</nowiki>Template&vert;param1=<var>23</var>&vert;size=<var>250px</var>&vert;<var>otherparams…</var><nowiki>}}</nowiki>}}}}. 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 {{Tag|pre}} tags.


:* {{Tlx|Tl|Tl}} display compared to {{Tlx|Tlx|Tl}}: (Tl: {{Tl|Tl}} versus Tlx: {{Tlx|Tl}})
<hr style="background-color: #a2a9b1; display: block; height: 2px; margin: 1.25em auto; max-width: 75vmax;" />


* If given no additional parameters except the template name, as in <code><nowiki>{{Tlx|Template&nbsp;name}}</nowiki></code> or <code><nowiki>{{Tlx|1=Template&nbsp;name}}</nowiki></code>, the output is functionally equivalent to the {{Tl|Tl}} macro template: a blue hyperlink nested in [[wikipedia:Bracket#Curly brackets|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 ⇒ {{Tl|Template}} versus Tlx ⇒ {{Tlx|Template}}
* Comparatively, {{Tlx|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.
* Comparatively, {{Tlx|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|Tlx}} has a named parameter, {{Para|subst}}, which when set to any value will place the string <code>subst:</code> before the template name, linked to [[wikipedia:Help:Substitution|Help:Substitution]]. This is useful to indicate when a template should be substituted; for example {{Tlx|Tlx|Template|3=subst=y}} will display {{Tlx|Template|subst=y}}.


* {{tlx|Tlx}} 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 {{tlx|Tlx|Welcome|<nowiki>subst=Y</nowiki>}} will display {{Tlx|Welcome|subst=Y}}.
== Usage ==
 
<kbd>'''&lbrace;{[[Template:{{BASEPAGENAME}}|{{BASEPAGENAME}}]]}&rbrace;'''</kbd> is a generalization of &lbrace;&lbrace;[[Template:Tl|Tl]]|x&rbrace;&rbrace;, et cetera, with arguably more readable output. This depends on the browser, but most of them use too narrow a form of <code>'''{'''</code>, <code>'''|'''</code> and <code>'''}'''</code> in conjunction with hyperlinks tend to be hard to read.
* 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. Small 'front end' Shell or convience templates {{Tlx|Tlxw}} and {{tlx|Tlxm}} are typing-aid templates available at Meta for automatic substitution in discussions about templates on Wikipedia or Meta.
 
----
 
;This usage also applies to interwiki capable template variations:
# {{Tl|Tlxc}} -- which links to templates on Wikimedia Commons (The Commons).
# {{Tl|Tlxm}} -- which links to templates on Meta
# {{Tl|Tlxw}} -- which links to templates on Wikipedia
 
----
 
==Documentation==


{&#123;[[Template:{{PAGENAME}}|{{PAGENAME}}]]&#125;}
=== Invocation ===
is a generalization of {{Tlxw|Tl|x}}, {{Tlxw|Tlp|x|y}},
:<kbd>{&lbrace;{{BASEPAGENAME}}&vert;Template name&rbrace;}</kbd>
etcetera with arguably better readable
:<kbd>{&lbrace;{{BASEPAGENAME}}&vert;Template name&vert;param&rbrace;}</kbd>
output. This depends on the browser, but too narrow
:<kbd>{&lbrace;{{BASEPAGENAME}}&vert;Template name&vert;1&vert;2&vert;3&vert;4&vert;5&vert;6&vert;7&vert;8&vert;9&vert;10&rbrace;}</kbd>
uses of "'''{'''", "'''|'''", "'''}'''" in conjunction
:<kbd>{&lbrace;{{BASEPAGENAME}}&vert;Template name&vert;1&vert;2&vert;3&vert;4&vert;5&vert;6&vert;7&vert;8&vert;9&vert;10&amp;vert;more&rbrace;}</kbd>
with links can be hard to read.
:<kbd>{&lbrace;{{BASEPAGENAME}}&vert;Template name&vert;param&amp;equals;<var>value</var>&rbrace;}</kbd>
 
''Up to 10 placeholders for parameters of the specified template''
=== Usage ===
 
:<tt>{&#123;{{PAGENAME}}{{!}}template name&#125;}</tt>
:<tt>{&#123;{{PAGENAME}}{{!}}template name{{!}}param&#125;}</tt>
:<tt>{&#123;{{PAGENAME}}{{!}}template name{{!}}1{{!}}2{{!}}3&#125;}</tt>
:<tt>{&#123;{{PAGENAME}}{{!}}template name{{!}}1{{!}}2{{!}}3&amp;#124;more&#125;}</tt>
:<tt>{&#123;{{PAGENAME}}{{!}}template name{{!}}param&amp;#61;value&#125;}</tt>
''Up to three placeholders for parameters of the specified template''


=== Examples ===
=== Examples ===
{{#ifeq:{{SITENAME}}|Wikipedia|<!-- Skip message--->|
{| class="wikitable" style="border: 1px solid #000; border-collapse: collapse; margin: 1em auto;"
{{#ifeq:{{SITENAME}}|Meta|<!-- No note needed --->|<!-- Other Sisters Note: --->
! scope="col" | Code
;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.
! scope="col" | Result
}}}}
! scope="col" | Remark
 
|-
{| border="1" cellpadding="4" class="wikitable"
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template}}</nowiki></kbd>
! Code
| {{Tlx|Template}} ||
! Result
|-
! Remark
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Abc}}</nowiki></kbd>
|-
| class="plainlinks" | <kbd><nowiki>{{</nowiki>[https://kodi.wiki/index.php?title=Template:Abc Abc]<nowiki>}}</nowiki></kbd> ||
|{{Tlx|SISTER=W:|Tlx|x0}}
|-
|{{Tlx|SISTER=W:|x0}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|ABC}}</nowiki></kbd>
||&#160;
| class="plainlinks" | <kbd><nowiki>{{</nowiki>[https://kodi.wiki/index.php?title=Template:ABC ABC]<nowiki>}}</nowiki></kbd> ||
|-
|-
|{{Tlx|SISTER=W:|Tlx|Abc}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|AbC}}</nowiki></kbd>
|{{Tlx|SISTER=W:|Abc}}
| class="plainlinks" | <kbd><nowiki>{{</nowiki>[https://kodi.wiki/index.php?title=Template:AbC AbC]<nowiki>}}</nowiki></kbd> ||
||&#160;
|-
|-
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|one}}</nowiki></kbd>
|{{Tlx|SISTER=W:|Tlx|ABC}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|one}}</nowiki></kbd> ||
|{{Tlx|SISTER=W:|ABC}}
|-
||&#160;
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|one|two}}</nowiki></kbd>
|-
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|one|two}}</nowiki></kbd> ||
|{{Tlx|SISTER=W:|Tlx|AbC}}
|-
|{{Tlx|SISTER=W:|AbC}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|1|2|3|4|5|6|7|8|9|10}}</nowiki></kbd>
||&#160;
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|1|2|3|4|5|6|7|8|9|10}}</nowiki></kbd> ||
|-
|-
|{{Tlx|SISTER=W:|Tlx|x1|one}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|1|2|3|4|5|6|7|8|9|10|11}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x1|one}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|1|2|3|4|5|6|7|8|9|10|…}}</nowiki></kbd>
||&#160;
| Accepts up to ten parameters, then <code></code>
|-
|-
|{{Tlx|SISTER=W:|Tlx|x2|one|two}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|1|2|3|4|5|6|7|8|9|10&amp;#124;11}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x2|one|two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|1|2|3|4|5|6|7|8|9|10|11}}</nowiki></kbd>
||&#160;
| But <code>&amp;#124;</code> instead of the pipe character will let you simulate more
|-
|-
|{{Tlx|SISTER=W:|Tlx|x3|1<tt>&#124;</tt>2<tt>&#124;</tt>3}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|&lt;nowiki>14|m|ftin|abbr=out|sp=us&lt;/nowiki>}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x3|1|2|3}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|14|m|ftin|abbr=out|sp=us}}</nowiki></kbd>
||&#160;
| You can also show an unlimited no. of parameters as a single {{Tag|nowiki}} string
|-
|-
|{{Tlx|SISTER=W:|Tlx|x4|1<tt>&#124;</tt>2<tt>&#124;</tt>3|4}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|x=u}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x4|1|2|3|4}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>}}</nowiki></kbd>
|up to 5 parameters, then ...
| Trying to show parameters with set values using a normal <code>=</code> won't work
|-
|-
|{{Tlx|SISTER=W:|Tlx|x4|1<tt>&#124;</tt>2<tt>&#124;</tt>3&amp;#124;4}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|x&amp;equals;u}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x4|1|2|3&#124;4}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|x&equals;u}}</nowiki></kbd>
|align="right"|<tt>&amp;#124;</tt> for more
| However, using the HTML entity for the equality sign (<code>&amp;equals;</code> or <code>&amp;#61;</code>) works just fine for that
|-
|-
|{{Tlx|SISTER=W:|Tlx|x1|x&#61;u}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|x{{=}}u}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x1|x=u}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|x=u}}</nowiki></kbd>
|'''=''' won't work
| <code><nowiki>{{=}}</nowiki></code> costs a few more ms of parser time per page load, but is okay too
|-
|-
|{{Tlx|SISTER=W:|Tlx|x1|x&amp;#61;u}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|&lt;nowiki&gt;x&#61;u&lt;/nowiki&gt;}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x1|x&#61;u}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|x=u}}</nowiki></kbd>
|align="right"|<tt>&amp;#61;</tt> is okay
| Sticky {{Tag|nowiki}} is a little messy, but works all the same
|-
|-
|{{Tlx|SISTER=W:|Tlx|x1|x<nowiki>{{=}}</nowiki>u}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|&nbsp;|two}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x1|x{{=}}u}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|two}}</nowiki></kbd>
|align="right"|<tt><nowiki>{{=}}</nowiki></tt> is okay
| Trying to show an empty positional parameter won't work using just a space
|-
|-
|{{Tlx|SISTER=W:|Tlx|x1|&lt;nowiki&gt;x&#61;u&lt;/nowiki&gt;}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|2=|3=two}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x1|<nowiki>x=u</nowiki>}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|two}}</nowiki></kbd>
|align="right"|sticky nowiki is okay
| Setting a named positional parameter to a null value is sneaky, but doesn't work either
|-
|-
|{{Tlx|SISTER=W:|Tlx|x2|&#160;|two}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|&amp;nbsp;|two}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x2| |two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|&nbsp;|two}}</nowiki></kbd>
|empty won't work
| But the HTML entity for a non-breaking space (<code>&amp;nbsp;</code>) will get it done
|-
|-
|{{Tlx|SISTER=W:|Tlx|x2|&amp;#32;|two}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|&amp;#8288;|two}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x2|&#32;|two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|&#8288;|two}}</nowiki></kbd>
|align="right"|<tt>&amp;#32;</tt> is okay
| A true WikiNinja&trade; will always prefer the invisible Word Joiner character (<code>&amp;#8288;</code>) for that, though
|-
|-
|{{Tlx|SISTER=W:|Tlx|x2|&amp;nbsp;|two}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|&amp;vert;two}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x2|&nbsp;|two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|&vert;two}}</nowiki></kbd>
|align="right"|<tt>&amp;nbsp;</tt> is okay
| The HTML entity for a pipe (<code>&amp;vert;</code>/<code>&amp;verbar;</code>/<code>&amp;#124;</code>/<code>&amp;VerticalLine;</code>), though a [[wikt:kludge|kludge]], looks okay too
|-
|-
|{{Tlx|SISTER=W:|Tlx|x2| &amp;#124; two}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|{{!}}two}}</nowiki></kbd>
|{{Tlx|SISTER=W:|x2| &#124; two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|&vert;two}}</nowiki></kbd>
|align="right"|<tt>&amp;#124;</tt> is okay
| And speaking of kludges, {{Tlx|!}} is much worse, since it costs extra parser time on each page load again
|-
|-
|| {{Tlx|SISTER=W:|Tlx|x2| {&#123;!&#125;} two}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|2=one|two}}</nowiki></kbd>
|| {{Tlx|SISTER=W:|x2| {{!}} two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|two}}</nowiki></kbd>
|align="right"|{{Tlx|SISTER=W:|!}} is dubious
| If a named and an unnamed positional parameter end up in a knife fight, the last one supplied always wins
|-
|-
|| {{Tlx|SISTER=W:|Tlx|x2|<nowiki>2=</nowiki>|<nowiki>3=two</nowiki>}}
| <kbd><nowiki>{{</nowiki>'''Tlx'''<nowiki>|Template|3=two|2=one}}</nowiki></kbd>
|| {{Tlx|SISTER=W:|x2|2=|3=two}}
| <kbd><nowiki>{{</nowiki>[[Template:Template|Template]]<nowiki>|one|two}}</nowiki></kbd>
|empty really doesn't work
| The order they're specified in doesn't matter, positional parameters are shown in numerical order by name
|-
|}<includeonly>
|| {{Tlx|SISTER=W:|Tlx|x2|<nowiki>2=one</nowiki>|two}}
|| {{Tlx|SISTER=W:|x2|2=one|two}}
|'''two''' clobbers '''2=one'''
|-
|| {{Tlx|SISTER=W:|Tlx|x2|<nowiki>3=two</nowiki>|<nowiki>2=one</nowiki>}}
|| {{Tlx|SISTER=W:|x2|3=two|2=one}}
|align="right"|right to left okay
|}
 
==See also==
[[w:Template:Para|Template:Para]] &ndash; for giving examples of template parameters and values only, instead of entire templates with parameters.
 
<!--- Categories applied to both /doc style Documentation page and to the parent templates --->
 
 
<!-- Add the Categories for this doc or usage page (only-- not for the calling template) BELOW THIS LINE --->
<noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
 
<includeonly>  
<!-- EDIT IN (calling) TEMPLATE CATEGORIES BELOW THIS LINE -->
[[Category:Typing-aid templates |{{PAGENAME}}]]
[[Category:Internal link templates |{{PAGENAME}}]]
[[Category:Interwiki link templates |{{PAGENAME}}]]




<!-- EDIT/ADD TEMPLATE Interwiki's BELOW THIS LINE -->
[[Category:Wiki templates]]</includeonly>
[[de:Vorlage:Vorlage]]
[[hsb:Předłoha:Tlx]]
[[ko:틀:Tlx]]
[[ia:Patrono:Tlx]]
[[ja:Template:Tlx]]
[[no:Mal:Tlx]]
[[ro:Format:Tlx]]
[[ru:Template:Tlx]]
[[simple:Template:Tlx]]
[[th:แม่แบบ:Tlx]]
[[uk:Шаблон:Tlx]]
</includeonly>

Latest revision as of 21:49, 13 September 2022

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