Template:Template link code/doc: Difference between revisions
(Created page with "{{Documentation subpage}} {{Lua|Module:Template link general}} {{Uses TemplateStyles|Template:Nowrap/styles.css}} __NOTOC__ == 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 {{tag|nowiki}} tags you can write it more simply and concisely by using the {{tlc|tlc}} template. It works similarly to {{tlc|tl}} but doesn't mak...") |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
{{Lua|Module:Template link general}} | {{Lua|Module:Template link general}} | ||
{{Uses TemplateStyles|Template:Nowrap/styles.css}} | {{Uses TemplateStyles|Template:Nowrap/styles.css}} | ||
{{tsh|tlc}} | |||
__NOTOC__ | __NOTOC__ | ||
Line 83: | Line 84: | ||
<!-- Categories below this line, please --> | <!-- Categories below this line, please --> | ||
[[Category:Template-link templates]] | [[Category:Template-link templates]] | ||
[[Category:Documentation formatting templates]] | [[Category:Documentation formatting templates]] | ||
}}}}</includeonly> | }}}}</includeonly> |
Latest revision as of 02:10, 20 August 2023
It contains usage information, categories and other content that is not part of the original template page.
|
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 |