More actions
No edit summary |
No edit summary |
||
| Line 74: | Line 74: | ||
|style=background-color:transparent;color:inherit<!-- to see background of <code>...</code> --> | |style=background-color:transparent;color:inherit<!-- to see background of <code>...</code> --> | ||
| Code | Output | Remarks | | Code | Output | Remarks | ||
| | | | {{{{{1|tlg}}}|Banner}} | Template:Banner does not exist. (Non-existent template is redlinked.) | ||
| {{ | | | {{{{{1|tlg}}}|Abc}} | Template:Abc exists. | ||
| {{ | | | {{{{{1|tlg}}}|abC}} | Template names are case-sensitive | ||
| | {{{{{1|tlg}}}|abc}} | (but the first letter is case-insensitive). | |||
| {{ | | | {{{{{1|tlg}}}|x0}} | no parameters | ||
| {{ | | | {{{{{1|tlg}}}|x1|one}} | one parameter | ||
| | {{{{{1|tlg}}}|x2|one|two}} | two parameters | |||
| {{ | | | {{{{{1|tlg}}}|x2|one{{=}}1|two{{=}}2}} | two parameters, assigned values | ||
| {{ | | | {{{{{1|tlg}}}|x3|1|2|3|4|5|6|7|8|9|10}} | ten parameters | ||
| {{ | | | {{{{{1|tlg}}}|convert|<nowiki>14|m|ftin|abbr=out|sp=us</nowiki>}} | Unlimited parameters, as one {{tag|nowiki|link=yes}} string. | ||
| | | | {{{{{1|tlg}}}|x2||two||}} | Empty parameters are discarded. | ||
| {{ | | | {{{{{1|tlg}}}|x0|code=on}} | <code> style | ||
| {{ | | | {{{{{1|tlg}}}|x0|plaincode=on}} | plaincode style | ||
| {{ | | | {{{{{1|tlg}}}|x0|kbd=on}} | <kbd> style | ||
| | {{{{{1|tlg}}}|x0|bold=on}} | bold link/name | |||
| {{ | | | {{{{{1|tlg}}}|x1|one|italic=on}} | parameter(s) in italics | ||
| | {{{{{1|tlg}}}|x0|nolink=on}} | | |||
| {{ | | | {{{{{1|tlg}}}|x0|subst=on}} | | ||
| | | | {{{{{1|tlg}}}|x0|brace=on}} | all braces in link | ||
| | {{{{{1|tlg}}}|x0|braceinside=on}} | inside braces in link | |||
| | {{{{{1|tlg}}}|x0|alttext=x0 link}} | | |||
| | {{{{{1|tlg}}}|x0|bold=on|code=on|brace=on}} | Combine multiple parameter settings. | |||
| | {{{{{1|tlg}}}|abc|{{spaces}}one{{spaces}}}} | Using {{tl|spaces}} before and after a parameter. | |||
| | {{{{{1|tlg}}}|x2|bold=on|code=on|one|two}} | Can combine named and anonymous parameters ... | |||
| | {{{{{1|tlg}}}|x2|one|two|bold=on|code=on}} | ... in any order ... | |||
| | {{{{{1|tlg}}}|x2|one|code=on|two|bold=on|three}} | ... even intermixed ... | |||
| | {{{{{1|tlg}}}|x2|one|code=on|two|bold=on|three|italic=on}} | ... with many configurations. | |||
| | {{{{{1|tlg}}}|x1|x=u}} | '''{{=}}''' won't work | |||
| | {{{{{1|tlg}}}|x1|x=u}} | <code>&#61;</code> is okay | |||
| | {{{{{1|tlg}}}|x1|x{{=}}u}} | <code><nowiki>{{=}}</nowiki></code> is okay (see Template:=) | |||
| | {{{{{1|tlg}}}|x1|x<nowiki>=</nowiki>u}} | Sticky nowiki is okay. | |||
| | {{{{{1|tlg}}}|x2|3=two|2=one}} | {{align|right|Right-to-left is okay}} | |||
| | {{{1|tlg}}} | With no arguments, it emits the current page name without braces. | |||
| | | | {{{{{1|tlg}}}|x2|3=one|4=two}} | Null parameter stops parsing. | ||
}} | }} | ||
| Line 116: | Line 116: | ||
! style="width:15em;" | Output | ! style="width:15em;" | Output | ||
|- | |- | ||
| | | |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}} | | {{{{{1|tlg}}}|long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}} | ||
|} | |} | ||
| Line 126: | Line 126: | ||
! style="width:15em;" | Output | ! style="width:15em;" | Output | ||
|- | |- | ||
| | | |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}} | | {{{{{1|tlg}}}|nowrap=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}} | ||
|} | |} | ||
| Line 136: | Line 136: | ||
! style="width:15em;" | Output | ! style="width:15em;" | Output | ||
|- | |- | ||
| | | |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}} | | {{{{{1|tlg}}}|nowrapname=on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}} | ||
|} | |} | ||
Revision as of 03:55, 9 April 2025
| This page uses Creative Commons Licensed content from Wikipedia (view authors). |
| This is a documentation subpage for Template:Template link general It may contain usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
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.
| Code | Output |
|---|---|
| long template name that would wrap to new line|this is a long value for the 1st parameter that would wrap}} | Template:Tlg |
| Code | Output |
|---|---|
| nowrap: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}} | Template:Tlg |
| Code | Output |
|---|---|
| nowrapname: on|long template name that would wrap to new line|long value for the 1st parameter that would wrap}} | Template:Tlg |
See also
Template:Template-linking templates