Template:Tnm/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 rendered using a monospace font, but is not linked to the template page. 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 no link, displayed as monospace text.

Parameters

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

Usage

{{Tnm|Template name}}

See the template's testcases:

Correct

One anonymous parameter: name of a template, whether it exists or not
Wiki code
{{Tnm|RootCmd}}
Main version
{{RootCmd}}
Sandbox version


One anonymous parameter containing a pipe character (illustrating a template call with a parameter)
Wiki code
{{Tnm|RootCmd{{!}}umount /mnt/gentoo}}
Main version
{{RootCmd|umount /mnt/gentoo}}
Sandbox version


↑ Note that this is OK when using this template, but will not work with the {{Tlm}} template.


One anonymous parameter containing a pipe and equals sign (illustrating a template call with named parameter)
Wiki code
{{Tnm|RootCmd{{!}}umount /mnt/gentoo{{!}}prompt{{=}}#}}
Main version
{{RootCmd|umount /mnt/gentoo|prompt=#}}
Sandbox version


↑ Note that this will not work when using the {{Tlm}} template.

Incorrect

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


Multiple anonymous parameters (not supported yet)
Wiki code
{{Tnm|RootCmd|umount /mnt/gentoo}}
Main version
{{RootCmd}}
Sandbox version


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}}