Template:Template link general/doc

This template is used to provide stylized formatting of links to templates without actually using the template itself. The output it generates will be an inline element.

Parameters

edit

With the exception of |alttext=, the named parameters are binary switches that are either omitted (the default, in most cases) or activated by being assigned a value (such as "on", "yes", "true", "1", etc.) and may be included in any order (see the main table and § Examples section below).

Parameter Action Use with
{{Kilometer|42}}
None Default (without accessory parameters) {{Kilometer|42}}
brace Include braces as part of the template link {{Kilometer}}|42
braceinside Include only innermost braces as part of the template link {{Kilometer}}|42
bold Render the template link/name in boldface {{Kilometer|42}}
code Display output inside HTML <code>…</code> tags (using a fixed-width font and subtle highlighting) {{Kilometer|42}}
italic Display template parameters in italics {{Kilometer|42}}
kbd Display output inside HTML <kbd>…</kbd> tags (fixed-width font without highlighting) {{Kilometer|42}}
nolink Don't render the template name as a link to itself {{Kilometer|42}}
nowrap Prevent the presence of any line breaks (text wrapping) in the output {{Kilometer|42}}
nowrapname Prevent text wrapping from occurring in the template name only, allowing parameters to wrap as needed {{Kilometer|42}}
plaincode Wraps output in HTML <code style="background: transparent; border: none;">…</code> tags
(semantically different from kbd parameter, but visually indistinguishable)
{{Kilometer|42}}
subst Displays template substitution (prefixing the template name with subst:) {{subst:Kilometer|42}}
alttext=[text] Replace the linked template's name with [text] {{Other|42}}
_show_result Will also display the result of the template call being demonstrated {{Kilometer|42}} → 42 km (26 mi)
_expand Will add a link to the expanded template page {{Kilometer|42}}
a Will add an asterisk before the template code to match the wikitext syntax for unordered (bulleted) lists * {{Kilometer|42}}

Unnamed (Positional)

edit

This template can take any number of unnamed parameters following the name of the template being linked to and will show them as parameters in the template call; see Examples below.

Examples

edit

Use the displayed value in the code column, not the underlying source code.

Code Output Remarks
{{Template link general|anCHor}} {{anCHor}} Template names are case-sensitive…
{{Template link general|anchor}} {{anchor}} …but the first letter is case-insensitive.
{{Template link general|Time|12:00PM|12:00AM}} {{Time|12:00PM|12:00AM}} Two parameters
{{Template link general|Anchor|1|2|3|4|5|6|7|8|9|10}} {{Anchor|1|2|3|4|5|6|7|8|9|10}} Ten parameters
{{Template link general|Convert|14|m|ftin|abbr=out|sp=us}} {{Convert|14|m|ftin|abbr=out|sp=us}} Unlimited parameters, as a single unnamed parameter containing a <nowiki></nowiki> string
{{Template link general|Anchor|two}} {{Anchor|two}} Empty parameters are discarded
{{Template link general|Anchor|code=on}} {{Anchor}} <code> style
{{Template link general|Anchor|plaincode=on}} {{Anchor}} plaincode style
{{Template link general|Anchor|kbd=on}} {{Anchor}} <kbd> style
{{Template link general|Anchor|bold=on}} {{Anchor}} Boldface template name link
{{Template link general|Anchor|italic=on}} {{Anchor}} Parameter(s) in italics
{{Template link general|Anchor|nolink=on}} {{Anchor}} nolink style
{{Template link general|Anchor|subst=on}} {{subst:Anchor}} Template substitution style
{{Template link general|Anchor|brace=on}} {{Anchor}} All braces as part of link
{{Template link general|Anchor|braceinside=on}} {{Anchor}} Only inner pair of braces linked with name
{{Template link general|Anchor|alttext=Anchor link}} {{Anchor link}} Custom linked template name
{{Template link general|Anchor|bold=on|code=on|brace=on}} {{Anchor}} Combining multiple parameter switches
{{Template link general|Anchor|one|two|bold=on|code=on}} {{Anchor|one|two}} Combining named (for formatting) and unnamed/positional (example) parameters
{{Template link general|Quote|''e{{=}}mc²''|author{{=}}Albert Einstein}} {{Quote|e=mc²|author=Albert Einstein}} Two parameters, with escaped equality symbols (=) in a parameter value
{{Template link general|Anchor|x&#61;u}} {{Anchor|x=u}} The decimal HTML entity for the equality symbol (&#61;) is another way to show parameters with values
{{Anchor}} {{Anchor}} Beware the accidental null parameter; they stop parsing at the point they're encountered
Code Output
Wrapping of long names (default)
{{Long template name that would wrap to a new line|Long value for the 1st parameter that would also get wrapped}} {{Long template name that would wrap to a new line|Long value for the 1st parameter that would also get wrapped}}
Wrapping of long names (nowrap=on)
{{Long template name that would wrap to a new line|Long value for the 1st parameter that would also get wrapped}} {{Long template name that would wrap to a new line|Long value for the 1st parameter that would also get wrapped}}
Wrapping of long names (nowrapname=on)
{{Long template name that would wrap to a new line|Long value for the 1st parameter that would also get wrapped}} Long value for the 1st parameter that would also get wrapped}}