Template:Template link/doc
| File:Edit-copy green.svg | This is a documentation subpage for Template:Template link. It may contain usage information, categories and other content that is not part of the original template page. |
The template link template is a simple macro template used to display a template name as a link surrounded by braces, thus showing the template name as code rather than actually invoking it. Its primary use is in instruction and documentation where it is used to refer to a template by name without invoking it.
Note that this template may be used under the name "tee-el" (tl) as well as "tee-one" (t1)— both function the same way and produce the same results. This is not true for all such visually confusing templates containing a possible 1/l mix-up as they are not interchangeable.
Template:Tl works exactly like Template:Tl with the addition of optionally displaying alternative label text (link label). Template:Tl can include the use of parameters in the template (as {{{1}}}).
Examples[edit source]
A short example of its use is:
- {{tl
|Example}}
- {{tl
- which generates
Other longer examples:
| Code | Result | Notes |
|---|---|---|
| {{tl |
Template:Tl | Standard usage |
| {{tls |
Template:Tls | For templates that should be substituted |
| {{tl2 |
{{X1}}
|
This formats the link to show how it would look in code (i.e., monospace font) |
| {{tl2 |
{{3x}}
|
Same as above, for templates on another Wikimedia project (in this example, Meta, using m:). See Interwiki codes.
|
| {{tl2 |
{{WP}}
|
For templates on another language project |
| {{tl |
Template:Tl | Use the format {{tl|1=templatename}} if the template contains template coding characters such as Template:Tl or Template:Tl
|
TemplateData[edit source]
Template:TemplateData header <templatedata>{ "description": "This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.", "params": { "1": { "label": "Template name", "description": "Positional parameter: the template name without the namespace prefix “Template:”, which is added automatically", "type": "wiki-template-name", "required": true } }, "format": "inline" }</templatedata>
See also[edit source]
- Template:tl2 (backlinks edit)
- Template:tl (backlinks edit)
- Template:tlp (backlinks edit) to produce a [t]emplate [l]ink with a single [p]arameter.
- Template:tlx (backlinks edit) to produce a [t]emplate [l]ink with an e[x]panded number of parameters.
- Template:tlsp (backlinks edit) to produce a [t]emplate [l]ink that's [s]ubst:ituted, with a single [p]arameter.
- Template:lts (backlinks edit)
- Template:tlu (backlinks edit), tl or tlp in any namespace.
- (edit talk links history)
- Template:tl-r (backlinks edit) to produce a [t]emplate [l]ink to a template [r]edirect.
General-purpose formatting[edit source]
| Text style ↓ | {{tlg}} options[note 1]to achieve text style |
Link style | |||||
|---|---|---|---|---|---|---|---|
| Linked | Unlinked | Linked with subst | Unlinked with subst | Linked including braces | Linked with alternative text | ||
{{tlg}} options[note 1]to achieve link style |
— | DEFAULT | <syntaxhighlight lang="text" class="" style="" inline="1">nolink=yes</syntaxhighlight> | <syntaxhighlight lang="text" class="" style="" inline="1">subst=yes</syntaxhighlight> | nolink=yes
|
<syntaxhighlight lang="text" class="" style="" inline="1">braceinside=yes</syntaxhighlight> | <syntaxhighlight lang="text" class="" style="" inline="1">alttext=Foo</syntaxhighlight> <syntaxhighlight lang="text" class="" style="" inline="1">2=Foo</syntaxhighlight> |
| normal | DEFAULT | Template:Nowrap Template:Tl Template:Tlp {{Template:tlu}} |
{{tlf}} <template link> |
Template:Tls {{subst:Template:tlsu}} |
{{subst:tlsf}} <template link> |
{{tn}} | {{tla}} |
code
|
<syntaxhighlight lang="text" class="" style="" inline="1">code=yes</syntaxhighlight> | {{tl2}}{{tlx}}{{Template:tlxu}} |
Template:Tlc <template link> {{tnull}}<template link>
|
{{subst:tlxs}}
|
{{subst:tlsc}}<template link> |
— | |
| monospace | <syntaxhighlight lang="text" class="" style="" inline="1">plaincode=yes</syntaxhighlight> |
— | {{subst:tltss}} |
— | |||
| kbd | <syntaxhighlight lang="text" class="" style="" inline="1">kbd=yes</syntaxhighlight> | ||||||
| bold | <syntaxhighlight lang="text" class="" style="" inline="1">bold=yes</syntaxhighlight> | {{tlb}} | — | ||||
bold+code
|
bold=yes
|
{{tlxb}}
| |||||
italic+code
|
italic=yes
|
{{tlxi}}
| |||||
Other formatting templates[edit source]
| Code example | Effect | Notes | |
|---|---|---|---|
| Template:Tlx |
| ||
|
<source lang="wikitext"> <syntaxhighlight lang="wikitext"> </syntaxhighlight> </source> |
<syntaxhighlight lang="wikitext">
</syntaxhighlight> |
Same as above | |
| Template:Tlx | {{Hatnote |
Supports colors, placeholder texts, named and unnamed parameters | |
Template:Xtag{{Hatnote|Some text|selfref=yes|category=no|lang=fr}}Template:Xtag
|
<syntaxhighlight lang="wikitext" inline></syntaxhighlight> | Same as above | |
| Template:Tlx | {{hatnote}} |
Supports linking to sister projects (e.g., fr:Hatnote) | |
| Template:Tlx | lang=fr|Some text}}</syntaxhighlight> | Shows code and example | |
| Template:Tlx | Template:Hatnote | Produces a normal link to the template | |
| Template:Tlx Template:Tlx |
[[Template:Hatnote]][[Template:Hatnote|Hatnote]] |
Formats wikilink, with optional piped link text and blended suffix | |
| Template:Tlx | {{#invoke:Example|hello}} | Counterpart to Template:Tl for linking to Lua modules | |
| Template:Tlx | {{#invoke:Example|hello}} | Similar to Template:Tl, but expects the function to be documented and creates a link to the corresponding section | |
| Template:Tlx | {{#invoke:Example|hello}} |
Counterpart to Template:Tl for linking to Lua modules | |
| Template:Tlx | <syntaxhighlight lang="lua" inline="1">require('Module:Example')</syntaxhighlight> | Link to Lua modules and built-in libraries, showing Lua code. | |
| Template:Tlx | Template:Para | Formats template parameters for display, with or without values | |
| Template:Tlx | [[WP:LASTING]] |
Takes a shortcut suffix in project namespace and displays it with brackets and the WP: alias in a [[WP:CODE|Template:Tag]] tag. | |
| Template:Tlx Template:Tlx |
Template:Tag Template:Xtag |
Formats [X]HTML tags; can add content, choose opening, closing, or self-closing | |
| Template:Tlx | {{d:Ping project}} | Wikidata counterpart to Template:Tl | |
| Template:Tlx Template:Tlx |
{{#if}} {{#if:{{{1}}}|true|false}} |
Parser function equivalent to Template:Tl | |
| Template:Tlx | {{uc:}} | Magic word links |
With utility links[edit source]
| Code example | Effect |
|---|---|
| Template:Tlx | Template:Hatnote (edit | talk | history | links | watch | logs) |
| Template:Tlx | Template:Hatnote(edit talk links history) |
| Template:Tlx | Template:T links/sandbox links Template:Yesno |
| Template:Tlx | Template:Hatnote (talk · history · transclusions · logs · subpages) |
| Template:Tlx | {{Hatnote}} |
| Template:Tlx | {{subst:Hatnote}} |
| Template:Tlx | Template:Hatnote (talk⧼dot-separator⧽links⧼dot-separator⧽edit) |
| Template:Tlx | Template:Hatnote (talk links edit) |
| Template:Tlx | m:Template:Hatnote (backlinks edit) |
| Template:Tlx | Template:Hatnote (backlinks edit) |
| Template:Tlx | {{Hatnote}} (talk) |
| Template:Tlx | Template:Hatnote (links, talk) |
| Template:Tlx | Template:Hatnote (links, talk) |
Cite error: <ref> tags exist for a group named "note", but no corresponding <references group="note"/> tag was found