Template:Template link code/doc: Difference between revisions

From HIBIKIFORUM
Jump to navigation Jump to search
(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
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__



Revision as of 03:21, 19 June 2023

Light bulb.png }}
It contains usage information, categories and other content that is not part of the original template page.


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}} {{name}}
{{tlc|name|one}} {{name|one}}
{{tlc|name|one|two}} {{name|one|two}}
{{tlc|name|1|2|3|4|5|6|7|8|9|10}} {{name|1|2|3|4|5|6|7|8|9|10}} Ten parameters
{{tlc|name|||three|four}} {{name|three|four}} Empty parameters are discared.
{{tlc|name|one=a|two=b}} {{name}} The use of equal signs is a problem, but there is a fix; see next row.
{{tlc|name|one{{=}}a|two{{=}}b}} {{name|one=a|two=b}} Use {{=}} in place of an equal sign, so that it gets rendered properly.

See Also

TemplateData

This template is used to link a template without actually using the template itself. Its primary use is in instruction and documentation.

Template parameters

ParameterDescriptionTypeStatus
template name1

positional parameter: the template name without the namespace prefix “Template:”, which is added automatically

Templaterequired