Template:Template link code: Difference between revisions
mNo edit summary |
mNo edit summary Tag: Manual revert |
(2 intermediate revisions by the same user not shown) | |
(No difference)
|
Latest revision as of 03:14, 19 June 2023
This template uses Lua: |
This template uses TemplateStyles: |
Purpose and naming
When a template name with braces is to be shown in documentation, the braces have to be escaped in some way so it doesn't become an actual call to the template. Instead of using <nowiki>...</nowiki>
tags you can write it more simply and concisely by using the {{tlc}}
template.
It works similarly to {{tl}}
but doesn't make the template name into a link. When writing documentation you might want to avoid a lot of unnecessary links, since they can decrease readability. So on the first occurrence of a template name use {{tl}}, and then use {{tlc}}
thereafter.
Basic operation
Here is how this template looks. Code is to the left; actual rendering to the right:
- {{tlc
|name |parameters}} → {{name|parameters}}
Documentation
Functional details
- This template takes another template-name and some associated pipe-tricked (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.
- Features of {{tlc}}:
- It shows a template name and any number of parameters.
- It prevents line wraps in their output.
Usage
{{Tlc|Template|first_parameter|second|third|fourth|...|eighth}}
→ {{Template|first_parameter|second|third|fourth|fifth|sixth|seventh|eighth}}
Examples
Code | Result | Comment |
---|---|---|
{{tlc |
{{name}}
|
|
{{tlc |
{{name|one}}
|
|
{{tlc |
{{name|one|two}}
|
|
{{tlc |
{{name|1|2|3|4|5|6|7|8|9|10}}
|
Ten parameters |
{{tlc |
{{name|three|four}}
|
Empty parameters are discared. |
{{tlc |
{{name}}
|
The use of equal signs is a problem, but there is a fix; see next row. |
{{tlc |
{{name|one=a|two=b}}
|
Use {{=}} in place of an equal sign, so that it gets rendered properly.
|
See Also
- {{Template link}}
- {{Template link with bold}}
- {{Template link with link off}}
- {{Template link spaced}}
TemplateData
This template is used to link a template without actually using the template itself. Its primary use is in instruction and documentation.
Parameter | Description | Type | Status | |
---|---|---|---|---|
template name | 1 | positional parameter: the template name without the namespace prefix “Template:”, which is added automatically | Template | required |