Template:Tl
The {{Tl}} or template link template is a simple macro template used to display a template name as a link surrounded by paired braces, showing how the transclusion would be performed in a page's wikitext. Its primary use is in instruction and documentation.
Usage
Use this template to show a use case for a template, e.g. {{Tl|Welcome}} produces {{Welcome}}.
Parameters
Up to nine (9) additional parameters may be supplied to this template which then appear again as sample parameters to the linked target page, e.g. {{Tl|Welcome|example}} produces {{Welcome|example}}.
If these additional parameters are intended to be shown with defined values as well, then one of two methods for doing so must be employed:
- All of the equality symbols between the parameter names and their values must be escaped in some way, either as
{{=}}or one of the character's HTML entity representations:=,=or=. Example:…which produces{{Tl|Welcome|para1{{=}}yes|para2=no|para3=on|para4=off}}
{{Welcome|para1=yes|para2=no|para3=on|para4=off}}. - All of the examples must be defined as named rather than unnamed parameters, as in the case of……which produces
{{Tl|Welcome|2=para1=yes|3=para2=no|4=whoknows=sure}}
{{Welcome|para1=yes|para2=no|whoknows=sure}}.
Parameter value semantics
Despite which method is ultimately used, it is highly recommended that correct semantics be used whenever documentation is being created. This means that example parameter values that only act as placeholders, indicating that a parameter should have some value but not the exact one shown, should always be wrapped inside the {{Var}} template. This provides a visual indication by showing the value in italic text, which is how modern web browsers interpret the semantic HTML <var>…</var> tags. Those tags also make that same contextual information available to those using assistive technologies such as screen readers, which will announce them as a representation of a variable and not an example for verbatim use.
Repeating the most recent example from above, assuming that the first two parameters are intended to show actual, real world usage, while the final parameter was included with a value only to show that a value of some kind should be present, the correct use of this template would be…
{{Tl|Welcome|2=para1=yes|3=para2=no|4=whoknows={{Var|sure}}}}
{{Welcome|para1=yes|para2=no|whoknows=sure}}.
TemplateData
Shows a wikilink formatted as a template call (wrapped in paired braces) with up to nine (9) example parameters
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Link target | 1 | The pagename to link to and show as formatted as a wikitext template transclusion, Template: namespace is inferred if absent
| Page name | required |
| Example parameter 1 | 2 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped
| Line | optional |
| Example parameter 2 | 3 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped
| Line | optional |
| Example parameter 3 | 4 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped
| Line | optional |
| Example parameter 4 | 5 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped
| Line | optional |
| Example parameter 5 | 6 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped
| Line | optional |
| Example parameter 6 | 7 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped | Line | optional |
| Example parameter 7 | 8 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped | Line | optional |
| Example parameter 8 | 9 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped | Line | optional |
| Example parameter 9 | 10 | Displayed after the linked page prefixed by a vertical bar ("pipe") character, demonstrating the presence of a template parameter; if a value is also shown, the equality symbol must be escaped | Line | optional |
| Show substituted | subst | When assigned any non-null value, the link will be show prefixed with 'subst:', indicating substitution rather than transclusion | Boolean | optional |
See also
{{Template link general}}– a much more versatile version of this template, implemented in Lua{{Template link universal}}– for demonstrating transclusions of target pages from any namespace, not just Template:{{Template link with parameters}}– also handles example parameters with values, e.g. {{SubclassTree|item=Q5|Q1}}{{Tla}}– generates link formatted as template call, but allows custom link text to be shown in place of target page name{{Tls}}– show links as substitutions (similar to this template when used with|subst=yes→{{subst:Tl}}), but withsubst:linked to Wikipedia:Substitution for documentation pages{{Para}}– for showing bare template parameter examples, typically within template or module documentation
Other template link templates
General-purpose formatting
| {{Tlg}} options[1] to achieve text style |
{{Tlg}} options to achieve link style[1] | |||||
|---|---|---|---|---|---|---|
| Linked DEFAULT
|
Unlinked nolink=yes
|
Linked with subst: subst=yes
|
Unlinked with subst: nolink=yes+subst=yes
|
Linked inc. inner braces braceinside=yes
|
Linked with custom text alttext=Foo
| |
| Normal DEFAULT
|
{{Tl}} {{Tlg}}[1] {{Tlp|1|2|…}}[2] {{Tlu}}[3] |
{{Tlf}} | {{subst:Tls}} {{subst:Tlsp}} {{subst:Tlsu}}[3] |
N/A | {{Tn}} | {{Tla}} (e.g., {{Foo}}) |
| Code code=yes
|
{{Tl2}}[4]{{Tlx}}{{T… l… expanded}}
|
{{Tlc}}{{Tnull}}[link]
|
{{subst:Tlxs}}
|
{{subst:Tlsc}}
|
N/A | |
| Monospace (<kbd>) kbd=yes[5] or plaincode=yes[6]
|
N/A | |||||
| ||||||
Other formatting templates
| Code example | Effect | Notes |
|---|---|---|
{{Hatnote|Some text}}
|
Some text
|
Used to create notes that appear at the tops of pages or sit just under section headers |
{{Module link|Age|age_generic}}
|
{{#invoke:Age|age_generic}} | Counterpart to {{Tl}} for linking to Lua modules |
{{Para|title|book_title}}
|
|title=book_title
|
Formats template parameters for display, with or without values |
{{Tag|ref}}
|
<ref>…</ref> | Formats HTML tags; can add content, choose opening, closing, paired or self-closing |
{{Parameter|foo}}
|
foo | Formats code so that it can be easily distinguished from running text |
{{Magic word|uc:}}
|
{{uc:}} | Magic word links |
{{Lts|Q}}
|
Template:Q (edit talk links history)
|
Links to template plus others to edit, Talk page, WhatLinksHere and history |
{{Tml3|Q|bracket=square}}
|
[[Q]] |
Offers choice of wrapping characters for template link: curly braces, square brackets or none |
{{Lte|Q}}
|
{{Q}}
|
|
{{T|Q}}
|
Q |
| The above documentation is transcluded from Template:Tl/doc (edit | history). Editors can experiment in this template's sandbox (create | mirror) and testcases (create) page. Please add categories to the /doc subpage. Subpages of this template. |