Template:Tl/doc

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
This page is a template. It contains some standardized, often used text, which can be transcluded inside other pages. As this template is widely used in our wiki, it may be protected in which case only staff members can change it. Use the discussion page to propose enhancements or fixes, or to voice your opinion.

This template provides a convenient way to refer to a template in regular text (say, in template documentation, on a help page, or on a talk page). It should not be used in articles (in the main namespace).

The displayed template name is enclosed in {{double-braces}} and linked to the template page, but no other special formatting is applied. Other similar templates that differ in terms of formatting or linking are listed below.

The name of this template refers to the fact that it shows a template name with a link.

Parameters

Parameter name Required? Default value Description
Anonymous parameter 1 Yes (n/a) Name of the template being linked to.

Usage

{{Tl|Template name}}

See the template's testcases:

Correct

One anonymous parameter matching a template name
Wiki code
{{Tl|RootCmd}}
Main version
Sandbox version


Using {{!}} (producing a piped link) and <nowiki> to illustrate a template call with a parameter
Wiki code
{{Tl|RootCmd{{!}}<nowiki>{{RootCmd|umount /mnt/gentoo}}</nowiki>}}
Main version
Sandbox version


↑ This is somewhat awkward, so you might want to avoid using this template to illustrate template calls containing parameters until it "natively supports" such use cases. In the meantime, the above link can be generated using [[Template:RootCmd|<nowiki>{{RootCmd|umount /mnt/gentoo}}</nowiki>]].

Incorrect

No parameter (error message)
Wiki code
{{Tl}}
Main version
{{Tl template error}}
Parameter unnamed not defined. For correct usage see Tl template's documentation on the unnamed parameter.
Sandbox version
{{Tl template error}}
Parameter unnamed not defined. For correct usage see Tl template's documentation on the unnamed parameter.


Two anonymous parameters to illustrate a template call containing a parameter (not supported)
Wiki code
{{Tl|RootCmd|umount /mnt/gentoo}}
Main version
Sandbox version


Two anonymous parameters to illustrate a template call containing multiple parameters (not supported)
Wiki code
{{Tl|RootCmd|umount /mnt/gentoo{{!}}output{{=}}umount: /mnt/gentoo: not mounted}}
Main version
Sandbox version


↑ Note that everything from "umount" to "not mounted" is a single anonymous parameter.


Three or more anonymous parameters (will probably never be supported)
Wiki code
{{Tl|RootCmd|umount /mnt/gentoo|output{{=}}umount: /mnt/gentoo: not mounted}}
Main version
Sandbox version


One anonymous parameter containing {{!}} to display a pipe character (makes a piped link instead)
Wiki code
{{Tl|RootCmd{{!}}umount /mnt/gentoo}}
Main version
Sandbox version


↑ Remember that the first anonymous parameter is assumed to be a template name that can be linked to.

See also[edit]

Here is the complete family of templates like this one, along with examples of their output (refer to each template's documentation for usage details and more examples):

  • {{Tl}} – show template name with double-braces, linked to template page → {{C}}
  • {{Tlc}} – show template name with double-braces, linked to template page, using <code> element → {{C}}
  • {{Tlm}} – show template name with double-braces, linked to template page, using monospace font → {{C}}
  • {{Tn}} – show template name with double-braces, not linked to template page → {{C}}
  • {{Tnc}} – show template name with double-braces, not linked to template page, using <code> element → {{C}}
  • {{Tnm}} – show template name with double-braces, not linked to template page, using monospace font → {{C}}


Alternative ways of referencing and/or linking to templates without using other templates include:

  • Using a plain page link: [[Template:C]]Template:C
  • Using single-braces: {C} / [[Template:C|{C}]] → {C} / {{C}}
  • Using double-braces around a link: {{[[Template:C|C]]}} → {{C}}
  • Using a nowiki element: <nowiki>{{C}}</nowiki> → {{C}}