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
Line 37: Line 37:
| 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''' || {{{{{1|tlg}}}|bold=yes|example}} || {{tl|tlb}}, {{tl|tlxb}}
|-
|-
| code || Display output using HTML [[HTML element#code|{{tag|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) || {{{{{1|tlg}}}|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'' ||| {{{{{1|tlg}}}|italic=yes|example|param}} || {{tl|tlxi}}
|-
|-
| kbd || Display output using HTML [[HTML element#kbd|{{tag|kbd}}]] tags (monospaced font) || {{{{{1|tlg}}}|kbd=yes|example}} ||
| kbd || Display output using HTML kbd tags (monospaced font) || {{{{{1|tlg}}}|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 || {{{{{1|tlg}}}|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 || {{{{{1|tlg}}}|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) || {{{{{1|tlg}}}|nowrapname=yes|example}} ||
Line 51: Line 51:
| 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;"}} || {{{{{1|tlg}}}|plaincode=yes|example}} || {{tl|tltss}}
|-
|-
| subst || Include a [[Help:Substitution|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 || {{{{{1|tlg}}}|subst=yes|example}} || {{tl|tls}}, {{tl|tlxs}}, 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 || {{{{{1|tlg}}}|alttext=Other|example}} || {{tl|tla}}
Line 63: Line 63:


====Unnamed (Positional)====
====Unnamed (Positional)====
This template can take any number of [[unnamed parameter]]s as parameters accompanying the template link (or name); see Examples below.
This template can take any number of unnamed parameters as parameters accompanying the template link (or name); see Examples below.


===Examples===
===Examples===
Line 83: Line 83:
  | {{tji|{{{1|tlg}}}|x2|2{{=}}one{{=}}1|3{{=}}two{{=}}2}}              | {{{{{1|tlg}}}|x2|one{{=}}1|two{{=}}2}}        | two parameters, assigned values
  | {{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}}}|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}} [[Help:Wikitext#Nowiki|string]].
  | {{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}}}|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|code: on}}              | {{{{{1|tlg}}}|x0|code=on}}        | &lt;code&gt; style
Line 103: Line 103:
  | {{tji|{{{1|tlg}}}|x1|x=u}}                                  | {{{{{1|tlg}}}|x1|x=u}}                      | '''{{=}}''' won't work
  | {{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>&#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:=|Template:=]])
  | {{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}}}|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}}}|x2|3: two|2: one}}            | {{{{{1|tlg}}}|x2|3=two|2=one}}              | {{align|right|Right-to-left is okay}}

Revision as of 16:35, 6 April 2025

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

This template, often abbreviated as {{tlg}}, 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 {{tj}}.

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 {{tlg}} needs to be used instead.

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

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.

Template:Aligned table

Wrapping of long names (default)
Code Output
Template:Tji Template:Tlg
Wrapping of long names (nowrap=on)
Code Output
Template:Tji Template:Tlg
Wrapping of long names (nowrapname=on)
Code Output
Template:Tji Template:Tlg

See also

Template:Template-linking templates Template:Semantic markup templates