Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Template link general/doc: Difference between revisions

Template page
No edit summary
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{wikipedia|page name}}
{{wikipedia|page name}}
{{Documentation subpage}}
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
<!--Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])-->
{{#switch:{{FULLPAGENAME}}|Template:Template link with subst|Template:Template link expanded={{used in system}}|#default=
{{#switch:{{FULLPAGENAME}}|Template:Template link with subst|Template:Template link expanded={{used in system}}|#default=
{{#ifexpr:{{#invoke:Transclusion count|fetch|0}} > 2000|{{high-use}}}}}}
{{#ifexpr:{{#invoke:Transclusion count|fetch|0}} > 2000|{{high-use}}}}}}
{{tsh|{{{1|tlg}}}|{{{2|}}}}}
{{lua|Module:Template link general}}


This template, often abbreviated as {{tlf|{{#switch:{{lc:{{ROOTPAGENAME}}}}
This template, often abbreviated as {{tlf|{{#switch:{{lc:{{ROOTPAGENAME}}}}
| tlg | template link general = tlg
| tlg | = tlg
| tlb | template link with bold = tlb
| tlb | template link with bold = tlb
| tlc | template link code = tlc
| tlc | template link code = tlc
Line 21: Line 18:
| tnull | template link null = tnull
| tnull | template link null = tnull
| tlp | template link with parameters = tlp}}
| tlp | template link with parameters = tlp}}
}}, is used to provide stylized formatting to template displays without actually using the template itself. The code generated will be displayed inline. For a multi-line output, see {{tl|tj}}.
}}, is used to provide stylized formatting to template displays without actually using the template itself. The code generated will be displayed inline. For a multi-line output, see.


===Parameters===
===Parameters===
With the exception of {{mono|alttext}}, the named parameters are toggles that are either omitted (default in most cases) or activated (by being assigned a value such as "on", "yes", "true", "include", etc.). They may be included in any order (see Examples below). Certain templates have the parameter "on" by default; see the main table for all alternate options. If a row renders identically to a previous row, it means the current template does not support that option and {{t|tlg}} needs to be used instead.
With the exception of {{mono|alttext}}, the named parameters are toggles that are either omitted (default in most cases) or activated (by being assigned a value such as "on", "yes", "true", "include", etc.). They may be included in any order (see Examples below). Certain templates have the parameter "on" by default; see the main table for all alternate options. If a row renders identically to a previous row, it means the current template does not support that option and needs to be used instead.


{| class="wikitable"
{| class="wikitable"
! Parameter || Action || Use with<br>{{tl|example}} || Default active
! Parameter || Action || Use with<br>{{tl|example}} || Default active
|-
|-
| || Default (without accessory parameters) || {{{{{1|tlg}}}|example}} ||
| || Default (without accessory parameters) || |example}} ||
|-
|-
| brace || Include braces as part of the template link || {{{{{1|tlg}}}|brace=yes|example}} || {{tl|tlw}}/{{tl|tn}}
| brace || Include braces as part of the template link |||brace=yes|example}} || /
|-
|-
| braceinside || Include innermost braces as part of the template link || {{{{{1|tlg}}}|example|braceinside=yes}} ||
| braceinside || Include innermost braces as part of the template link || |example|braceinside=yes}} ||
|-
|-
| bold || Renders the template link/name in '''bold''' || {{{{{1|tlg}}}|bold=yes|example}} || {{tl|tlb}}, {{tl|tlxb}}
| bold || Renders the template link/name in '''bold''' |||bold=yes|example}} || ,  
|-
|-
| code || Display output using HTML code tags (monospaced font) || {{{{{1|tlg}}}|code=yes|example}} || {{tl|tlc}}, {{tl|Template link expanded}}, etc.
| code || Display output using HTML code tags (monospaced font) || |code=yes|example}} || {{tl|tlc}}, {{tl|Template link expanded}}, etc.
|-
|-
| italic || Display any parameters accompanying the template link/name in ''italics'' ||| {{{{{1|tlg}}}|italic=yes|example|param}} || {{tl|tlxi}}
| italic || Display any parameters accompanying the template link/name in ''italics'' ||| |italic=yes|example|param}} ||  
|-
|-
| kbd || Display output using HTML kbd tags (monospaced font) || {{{{{1|tlg}}}|kbd=yes|example}} ||
| kbd || Display output using HTML kbd tags (monospaced font) || |kbd=yes|example}} ||
|-
|-
| nolink || Don't render the template name as a link || {{{{{1|tlg}}}|nolink=yes|example}} || {{tl|tlf}}, {{tl|tnull}}
| nolink || Don't render the template name as a link || |nolink=yes|example}} || {{tl|tlf}}, {{tl|tnull}}
|-
|-
| nowrap || Prevent the insertion of line breaks (word wrap) in the output || {{{{{1|tlg}}}|nowrap=yes|example}} || {{tl|tlp}}
| nowrap || Prevent the insertion of line breaks (word wrap) in the output |||nowrap=yes|example}} || {{tl|tlp}}
|-
|-
| nowrapname || Prevent word wrapping in the output of template name/link (parameters will wrap if needed) || {{{{{1|tlg}}}|nowrapname=yes|example}} ||
| nowrapname || Prevent word wrapping in the output of template name/link (parameters will wrap if needed) || |nowrapname=yes|example}} ||
|-
|-
| plaincode || Uses {{tag|code|params=style="border:none; background:transparent;"}} || {{{{{1|tlg}}}|plaincode=yes|example}} || {{tl|tltss}}
| plaincode || Uses {{tag|code|params=style="border:none; background:transparent;"}} || |plaincode=yes|example}} ||  
|-
|-
| subst || Include a subst: prefix before the template link/name || {{{{{1|tlg}}}|subst=yes|example}} || {{tl|tls}}, {{tl|tlxs}}, etc
| subst || Include a subst: prefix before the template link/name || |subst=yes|example}} || , , etc
|-
|-
| alttext=<code style="padding:0; margin:0">[text]</code> || Replace <code style="padding:0; margin:0">[text]</code> with the actual label to be displayed for the template link || {{{{{1|tlg}}}|alttext=Other|example}} || {{tl|tla}}
| alttext=<code style="padding:0; margin:0">[text]</code> || Replace <code style="padding:0; margin:0">[text]</code> with the actual label to be displayed for the template link || |alttext=Other|example}} ||  
|-
|-
| _show_result || Will also display the result of the template || {{{{{1|tlg}}}|Min|7|-5|_show_result=y}} ||
| _show_result || Will also display the result of the template || |Min|7|-5|_show_result=y}} ||
|-
|-
| _expand || Will add a link to the expanded template page || {{{{{1|tlg}}}|Min|7|-5|_expand=y}} ||
| _expand || Will add a link to the expanded template page |||Min|7|-5|_expand=y}} ||
|-
|-
| a || will add an asterisk before the template code || {{{{{1|tlg}}}|Min|7|-5|a=y}} ||
| a || will add an asterisk before the template code |||Min|7|-5|a=y}} ||
|}
|}


Line 69: Line 66:
{{#switch:{{SITENAME}} |Wikipedia|Meta= |
{{#switch:{{SITENAME}} |Wikipedia|Meta= |
; Note: On the source sister projects, en.wikipedia and Meta, '''X0, X1, X2, ..., X9 are sandbox templates''' for experimentation on involved templates that need be in template space. An auto-cleansing software facility exists that might be used to duplicate the facility on other Sister projects.
; Note: On the source sister projects, en.wikipedia and Meta, '''X0, X1, X2, ..., X9 are sandbox templates''' for experimentation on involved templates that need be in template space. An auto-cleansing software facility exists that might be used to duplicate the facility on other Sister projects.
}}
{{Aligned table
|cols=3 |class=wikitable |row1header=y
|style=background-color:transparent;color:inherit<!-- to see background of <code>...</code> -->
| Code                                        | Output                            | Remarks
| {{tji|{{{1|tlg}}}|Banner}}                  | {{{{{1|tlg}}}|Banner}}            | Template:Banner does not exist. (Non-existent template is redlinked.)
| {{tji|{{{1|tlg}}}|Abc}}                      | {{{{{1|tlg}}}|Abc}}                | Template:Abc exists.
| {{tji|{{{1|tlg}}}|abC}}                      | {{{{{1|tlg}}}|abC}}                | Template names are case-sensitive
| {{tji|{{{1|tlg}}}|abc}}                      | {{{{{1|tlg}}}|abc}}                | (but the first letter is case-insensitive).
| {{tji|{{{1|tlg}}}|x0}}                      | {{{{{1|tlg}}}|x0}}                | no parameters
| {{tji|{{{1|tlg}}}|x1|one}}                  | {{{{{1|tlg}}}|x1|one}}            | one parameter
| {{tji|{{{1|tlg}}}|x2|one|two}}              | {{{{{1|tlg}}}|x2|one|two}}        | two parameters
| {{tji|{{{1|tlg}}}|x2|2{{=}}one{{=}}1|3{{=}}two{{=}}2}}              | {{{{{1|tlg}}}|x2|one{{=}}1|two{{=}}2}}        | two parameters, assigned values
| {{tji|{{{1|tlg}}}|x3|1|2|3|4|5|6|7|8|9|10}}  | {{{{{1|tlg}}}|x3|1|2|3|4|5|6|7|8|9|10}} | ten parameters
| {{tji|{{{1|tlg}}}|convert|<nowiki><nowiki>14|m|ftin|abbr=out|sp=us</nowiki></nowiki>}} | {{{{{1|tlg}}}|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} | Unlimited parameters, as one {{tag|nowiki|link=yes}} string.
| {{tji|{{{1|tlg}}}|x2||two||}}  | {{{{{1|tlg}}}|x2||two||}}      | Empty parameters are discarded.
| {{tji|{{{1|tlg}}}|x0|code: on}}              | {{{{{1|tlg}}}|x0|code=on}}        | &lt;code&gt; style
| {{tji|{{{1|tlg}}}|x0|plaincode: on}}        | {{{{{1|tlg}}}|x0|plaincode=on}}    | plaincode style
| {{tji|{{{1|tlg}}}|x0|kbd: on}}                  | {{{{{1|tlg}}}|x0|kbd=on}}          | &lt;kbd&gt; style
| {{tji|{{{1|tlg}}}|x0|bold: on}}              | {{{{{1|tlg}}}|x0|bold=on}}        | bold link/name
| {{tji|{{{1|tlg}}}|x1|one|italic: on}}        | {{{{{1|tlg}}}|x1|one|italic=on}}  | parameter(s) in italics
| {{tji|{{{1|tlg}}}|x0|nolink: on}}            | {{{{{1|tlg}}}|x0|nolink=on}}      |
| {{tji|{{{1|tlg}}}|x0|subst: on}}            | {{{{{1|tlg}}}|x0|subst=on}}        |
| {{tji|{{{1|tlg}}}|x0|brace: on}}            | {{{{{1|tlg}}}|x0|brace=on}}        | all braces in link
| {{tji|{{{1|tlg}}}|x0|braceinside: on}}      | {{{{{1|tlg}}}|x0|braceinside=on}}  | inside braces in link
| {{tji|{{{1|tlg}}}|x0|alttext: x0 link}}      | {{{{{1|tlg}}}|x0|alttext=x0 link}} |
| {{tji|{{{1|tlg}}}|x0|bold: on|code: on|brace: on}}    | {{{{{1|tlg}}}|x0|bold=on|code=on|brace=on}} | Combine multiple parameter settings.
| {{tji|{{{1|tlg}}}|abc|{{((}}spaces{{))}}one{{((}}spaces{{))}}}} | {{{{{1|tlg}}}|abc|{{spaces}}one{{spaces}}}} | Using {{tl|spaces}} before and after a parameter.
| {{tji|{{{1|tlg}}}|x2|bold: on|code: on|one|two}}                | {{{{{1|tlg}}}|x2|bold=on|code=on|one|two}}  | Can combine named and anonymous parameters ...
| {{tji|{{{1|tlg}}}|x2|one|two|bold: on|code: on}}                | {{{{{1|tlg}}}|x2|one|two|bold=on|code=on}}  | ... in any order ...
| {{tji|{{{1|tlg}}}|x2|one|code: on|two|bold: on|three}}          | {{{{{1|tlg}}}|x2|one|code=on|two|bold=on|three}} | ... even intermixed ...
| {{tji|{{{1|tlg}}}|x2|one|code: on|two|bold: on|three|italic: on}} | {{{{{1|tlg}}}|x2|one|code=on|two|bold=on|three|italic=on}} | ... with many configurations.
| {{tji|{{{1|tlg}}}|x1|x=u}}                                  | {{{{{1|tlg}}}|x1|x=u}}                      | '''{{=}}''' won't work
| {{tji|{{{1|tlg}}}|x1|x<nowiki>&#61;</nowiki>u}}                              | {{{{{1|tlg}}}|x1|x&#61;u}}                  | <code>&amp;#61;</code> is okay
| {{tji|{{{1|tlg}}}|x1|x<nowiki>{{=}}</nowiki>u}}                | {{{{{1|tlg}}}|x1|x{{=}}u}}                  | <code><nowiki>{{=}}</nowiki></code> is okay  (see Template:=)
| {{tji|{{{1|tlg}}}|x1|x{{tag|nowiki|p|{{=}}|link=no}}u}}    | {{{{{1|tlg}}}|x1|x<nowiki>=</nowiki>u}}    | Sticky nowiki is okay.
| {{tji|{{{1|tlg}}}|x2|3: two|2: one}}            | {{{{{1|tlg}}}|x2|3=two|2=one}}              | {{align|right|Right-to-left is okay}}
| {{tji|{{{1|tlg}}}}}                                            | {{{1|tlg}}}                                | With no arguments, it emits the current page name without braces.
| {{tji|{{{1|tlg}}}|x2|3: one|4: two}}            | {{{{{1|tlg}}}|x2|3=one|4=two}}              | Null parameter stops parsing.
}}
}}


Line 116: Line 74:
! style="width:15em;" | Output
! style="width:15em;" | Output
|-
|-
| {{tji|{{{1|tlg}}}|long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}}
| |long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}}
| {{{{{1|tlg}}}|long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}}
| |long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}}
|}
|}


Line 126: Line 84:
! style="width:15em;" | Output
! style="width:15em;" | Output
|-
|-
| {{tji|{{{1|tlg}}}|nowrap: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
| |nowrap: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
| {{{{{1|tlg}}}|nowrap=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
| |nowrap=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
|}
|}


Line 136: Line 94:
! style="width:15em;" | Output
! style="width:15em;" | Output
|-
|-
| {{tji|{{{1|tlg}}}|nowrapname: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
| |nowrapname: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
| {{{{{1|tlg}}}|nowrapname=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
||nowrapname=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
|}
|}
==See also==
{{Template-linking templates}}
{{Semantic markup templates}}


<includeonly>{{Sandbox other|
<includeonly>{{Sandbox other|

Latest revision as of 10:09, 19 April 2025

This page uses Creative Commons Licensed content from Wikipedia (view authors).


This template, often abbreviated as {{}}, is used to provide stylized formatting to template displays without actually using the template itself. The code generated will be displayed inline. For a multi-line output, see.

Parameters

With the exception of alttext, the named parameters are toggles that are either omitted (default in most cases) or activated (by being assigned a value such as "on", "yes", "true", "include", etc.). They may be included in any order (see Examples below). Certain templates have the parameter "on" by default; see the main table for all alternate options. If a row renders identically to a previous row, it means the current template does not support that option and needs to be used instead.

Parameter Action Use with
{{example}}
Default active
Default (without accessory parameters) example}}
brace Include braces as part of the template link brace=yes|example}} /
braceinside Include innermost braces as part of the template link example|braceinside=yes}}
bold Renders the template link/name in bold bold=yes|example}} ,
code Display output using HTML code tags (monospaced font) code=yes|example}} {{tlc}}, {{Template link expanded}}, etc.
italic Display any parameters accompanying the template link/name in italics |italic=yes|example|param}}
kbd Display output using HTML kbd tags (monospaced font) kbd=yes|example}}
nolink Don't render the template name as a link nolink=yes|example}} {{tlf}}, {{tnull}}
nowrap Prevent the insertion of line breaks (word wrap) in the output nowrap=yes|example}} {{tlp}}
nowrapname Prevent word wrapping in the output of template name/link (parameters will wrap if needed) nowrapname=yes|example}}
plaincode Uses <code style="border:none; background:transparent;">...</code> plaincode=yes|example}}
subst Include a subst: prefix before the template link/name subst=yes|example}} , , etc
alttext=[text] Replace [text] with the actual label to be displayed for the template link alttext=Other|example}}
_show_result Will also display the result of the template Min|7|-5|_show_result=y}}
_expand Will add a link to the expanded template page Min|7|-5|_expand=y}}
a will add an asterisk before the template code Min|7|-5|a=y}}

Unnamed (Positional)

This template can take any number of unnamed parameters as parameters accompanying the template link (or name); see Examples below.

Examples

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

Note
On the source sister projects, en.wikipedia and Meta, X0, X1, X2, ..., X9 are sandbox templates for experimentation on involved templates that need be in template space. An auto-cleansing software facility exists that might be used to duplicate the facility on other Sister projects.
Wrapping of long names (default)
Code Output
long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}} long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}}
Wrapping of long names (nowrap=on)
Code Output
nowrap: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}} nowrap=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}
Wrapping of long names (nowrapname=on)
Code Output
nowrapname: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}} nowrapname=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}}