Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Tlx/doc: Difference between revisions

Template page
Wikify table and add another option.
m code instead of tt tag
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{documentation subpage}}
This template creates example usage syntax for a template, and links the name to the template page. The name is derived from "'''T'''emplate '''l'''ist e'''x'''panded".


This is the {{tl|tlx}} or '''t'''emplate '''l'''ink e'''x'''panded template.
Up to 7 pass parameters (numbered) for the specified template are displayed as 'placeholders', and more parameters are shown as "<code>|</code>''...''". An optional <code>SISTER</code> parameter can specify an interwiki prefix to link to another wiki. Examples:


It can be used in documentation and talk page discussions to show how a template name would be used in code.
{| border="1" cellpadding="4" class="wikitable"
 
! Code
Here is how this template looks. Code to the left and actual rendering to the right:
! Result
 
! Remark
:{{tlc|tlx|name|parameters}} = {{tlx|name|parameters}}
|-
 
|{{Tlx|SISTER=W:|Tlx|x0}}
Features of {{tl|tlx}}:
|{{Tlx|SISTER=W:|x0}}
* It shows a template name with a link to that template.
||&#160;
* It shows up to eight parameters.
|-
* It also shows empty parameters. (See examples below.)
|{{Tlx|SISTER=W:|Tlx|x1|one}}
* It prevents line wraps in its output.
|{{Tlx|SISTER=W:|x1|one}}
 
||&#160;
This template belongs to a family of similar templates. For instance, when writing documentation you might want to avoid a lot of unnecessary links, since it decreases readability. Then on the first occurrence of a template name use {{tl|tl}}, or {{tlx|tlx}}, and then use {{tlf|tlf}}, {{tld|tld}} or {{tlc|tlc}}.
|-
 
|{{Tlx|SISTER=W:|Tlx|x2|one|two}}
=== Examples ===
|{{Tlx|SISTER=W:|x2|one|two}}
{| class="wikitable"
||&#160;
|-
|{{Tlx|SISTER=W:|Tlx|x3|1<code>&#124;</code>2<code>&#124;</code>3}}
|{{Tlx|SISTER=W:|x3|1|2|3}}
||&#160;
|-
|{{Tlx|SISTER=W:|Tlx|x4|1<code>&#124;</code>2<code>&#124;</code>3|4}}
|{{Tlx|SISTER=W:|x4|1|2|3|4}}
|up to 7 parameters, then ...
|-
|-
!Code !!Result !!Comment
|{{Tlx|SISTER=W:|Tlx|x4|1<code>&#124;</code>2<code>&#124;</code>3&amp;#124;4}}
|{{Tlx|SISTER=W:|x4|1|2|3&#124;4}}
|align="right"|<code>&amp;#124;</code> for more
|-
|-
|{{tlc|tlx}} ||{{tlx}} ||Shows its own syntax.
|{{Tlx|SISTER=W:|Tlx|x1|x&#61;u}}
|{{Tlx|SISTER=W:|x1|x=u}}
|'''=''' won't work
|-
|-
|{{tlc|tlx|name}} ||{{tlx|name}} ||
|{{Tlx|SISTER=W:|Tlx|x1|x&amp;#61;u}}
|{{Tlx|SISTER=W:|x1|x&#61;u}}
|align="right"|<code>&amp;#61;</code> is okay
|-
|-
|{{tlc|tlx|name|one}} ||{{tlx|name|one}} ||
|{{Tlx|SISTER=W:|Tlx|x1|&lt;nowiki&gt;x&#61;u&lt;/nowiki&gt;}}
|{{Tlx|SISTER=W:|x1|<nowiki>x=u</nowiki>}}
|align="right"|sticky nowiki is okay
|-
|-
|{{tlc|tlx|name|one|two}} ||{{tlx|name|one|two}} ||
|{{Tlx|SISTER=W:|Tlx|x2|&#160;|two}}
|{{Tlx|SISTER=W:|x2| |two}}
|empty won't work
|-
|-
|<code><nowiki>{{tlx|name|a|b|c|d|e|f|g|h|i|j}}</nowiki></code> ||{{tlx|name|a|b|c|d|e|f|g|h|i}} ||Shows up to eight parameters. The rest are dropped.
|{{Tlx|SISTER=W:|Tlx|x2|&amp;#32;|two}}
|{{Tlx|SISTER=W:|x2|&#32;|two}}
|align="right"|<code>&amp;#32;</code> is okay
|-
|-
|{{tlc|tlx|name|||three|four}} ||{{tlx|name|||three|four}} ||Also shows empty parameters.
|{{Tlx|SISTER=W:|Tlx|x2|&amp;nbsp;|two}}
|{{Tlx|SISTER=W:|x2|&nbsp;|two}}
|align="right"|<code>&amp;nbsp;</code> is okay
|-
|-
|{{tlc|tlx|name|||three||}} ||{{tlx|name|||three||}} ||Even shows empty parameters that come in the end.
|{{Tlx|SISTER=W:|Tlx|x2| &amp;#124; two}}
|{{Tlx|SISTER=W:|x2| &#124; two}}
|align="right"|<code>&amp;#124;</code> is okay
|-
|-
|{{tlc|tlx|name|3=one=a|4=two=b}} ||{{tlx|name|one=a|two=b}} ||Equal signs are a problem, but there are fixes.
|| {{Tlx|SISTER=W:|Tlx|x2| {&#123;!&#125;} two}}
|| {{Tlx|SISTER=W:|x2| {{!}} two}}
|align="right"|{{Tlx|SISTER=W:|!}} is dubious
|-
|-
|{{tlc|tlx|name|3=2=one=a|4=3=two=b}} ||{{tlx|name|2=one=a|3=two=b}} ||Use numbered parameters to fix it. Remember to start from 2, since the "name" is number 1.
|| {{Tlx|SISTER=W:|Tlx|x2|<nowiki>2=</nowiki>|<nowiki>3=two</nowiki>}}
|| {{Tlx|SISTER=W:|x2|2=|3=two}}
|empty really doesn't work
|-
|-
|{{tlc|tlx|name|3=one<nowiki>{{=}}</nowiki>a|4=two<nowiki>{{=}}</nowiki>b}} ||{{tlx|name|one{{=}}a|two{{=}}b}} ||Use the {{[[Template:Equal|=]]}} workaround template.
|| {{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
If you have equal signs in your template parameters then some find it simpler to code it using <code>&lt;nowiki></code> tags. Here's how to do that. Code to the left and actual rendering to the right:
|}<includeonly>[[Category:Internal link templates|Tlx]]
 
----
:<code><nowiki>{{tlx|name|&lt;nowiki>one=a|two=b&lt;/nowiki>}}</nowiki></code> = {{tlx|name|<nowiki>one=a|two=b</nowiki>}}
<templatedata>
{ "description": "Template list expanded",
"params": {
"1": {
"label": "Template",
"description": "Linked template name",
"type": "string/wiki-page-name"
},
"2": {
"label": "Parameter",
"description": "Optional parameter",
"type": "string"
},
"3": {
"description": "For 2 parameters",
"type": "string"
},
"4": {
"description": "For 3 parameters",
"type": "string"
},
"5": {
"description": "For 4 parameters",
"type": "string"
},
"6": {
"description": "For 5 parameters",
"type": "string"
},
"7": {
"description": "For 6 parameters",
"type": "string"
},
"8": {
"description": "For 7 parameters",
"type": "string"
},
"9": {
"description": "For 8 parameters",
"type": "string"
},
"10": {
"description": "For 9 parameters",
"type": "string"
},
"11": {
"label": "Overflow",
"description": "Overflow shown as ...",
"type": "string"
},
"SISTER": {
"label": "Interwiki",
"description": "Optional InterWiki link prefix",
"type": "string"
} } }</templatedata></includeonly>


<includeonly>
==={{int:Seealso}}===
[[Category:Typing-aid templates|{{PAGENAME}}]]
{{Template names}}
[[Category:Internal link templates|{{PAGENAME}}]]
</includeonly>

Latest revision as of 20:32, 27 October 2022

This template creates example usage syntax for a template, and links the name to the template page. The name is derived from "Template list expanded".

Up to 7 pass parameters (numbered) for the specified template are displayed as 'placeholders', and more parameters are shown as "|...". An optional SISTER parameter can specify an interwiki prefix to link to another wiki. Examples:

Code Result Remark
{{Tlx|x0}} {{x0}}  
{{Tlx|x1|one}} {{x1|one}}  
{{Tlx|x2|one|two}} {{x2|one|two}}  
{{Tlx|x3|1|2|3}} {{x3|1|2|3}}  
{{Tlx|x4|1|2|3|4}} {{x4|1|2|3|4}} up to 7 parameters, then ...
{{Tlx|x4|1|2|3&#124;4}} {{x4|1|2|3|4}} &#124; for more
{{Tlx|x1|x=u}} {{x1}} = won't work
{{Tlx|x1|x&#61;u}} {{x1|x=u}} &#61; is okay
{{Tlx|x1|<nowiki>x=u</nowiki>}} {{x1|x=u}} sticky nowiki is okay
{{Tlx|x2| |two}} {{x2|two}} empty won't work
{{Tlx|x2|&#32;|two}} {{x2| |two}} &#32; is okay
{{Tlx|x2|&nbsp;|two}} {{x2| |two}} &nbsp; is okay
{{Tlx|x2| &#124; two}} {{x2| | two}} &#124; is okay
{{Tlx|x2| {{!}} two}} {{x2| | two}} {{!}} is dubious
{{Tlx|x2|2=|3=two}} {{x2|two}} empty really doesn't work
{{Tlx|x2|3=two|2=one}} {{x2|one|two}} right to left okay

See also

  • {{Tlc}}{{Example}} – Not linked, several parameters and text in <code></code> style.
  • {{Tld}}{{Example}} – Template link, several parameters and teletype text style[Please clarify – October 2024].
  • {{Tle}} – {{ TleExample }} – Linked or not, expanded parameter description
  • {{Tlf}}{{Example}} – Not linked, several parameters and normal text style.
  • {{Tl}}0{{Example}} – Linked, no parameters or simple ones[Please clarify – October 2024], and teletype text style[Please clarify – October 2024].
  • {{Tlx}} – {{Example}} – Template link, several parameters and normal text style.
  • {{Tlp}}{{Example}} – Template link, several non-blank parameters and normal text style.
  • {{Tlu}} – {{Example}} – Link to arbitrary other namespace.

with subst

For more see: Commons:Link templates

Contents
Cookies help us deliver our services. By using our services, you agree to our use of cookies.