Template:Tle/doc

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Displays Wikitext to invoke a template

Shows a synopsis or an example invocation for a template. The example or synopsis can use parameters of the documented templates, whether these are named or not.

Usage

{{Tle |T= }}

Template parameters

ParameterDescriptionDefaultStatus
TName of the template, which will be displayed as a linkTleoptional
tname of the template; Will be displayed as plain text
When parameter "T" is specified, an additional parameter "t" is ignored
emptyoptional
1  … nparameter value(s); may contain wiki syntax, if necessaryemptyoptional
p1 … pnparameter name(s)[clarification needed]   (none for positional parameters)emptyoptional
fSeparator between parameters to format the display - see #Format exampleemptyoptional
numberany value: show the default numbers of positional parametersemptyoptional
kbdany value: displays parameter names with fixed-pitch fontemptyoptional
stylepossible display style modification - see #Style exampleemptyoptional

Additional information

The template is intended to be used in the following namespaces: the Template namespace

The template is intended to be used by the following user groups: Template editors

See also

{{Para}}

{{Showname}} to see all parameters and values of a template transclusion

The template does not generate any localizable text.

Explanation

Wikimedia Commons has lots of other templates to document templates, but none is really able to describe complicated parametrizing easily.

{{ Tle }} describes each parameter as a meta-pair |pn= |n= , an optional meta-parameter p1...pn for the name and an optional unnamed meta-parameter for the value.
For unnamed parameters this name can be the number; if even that is not needed, some or all meta-parameter names may dismiss.

How to use

After specifying the template name, its parameter values are specified with the unnamed meta-parameters; its parameter names can be specified with the meta-parameters p1 to pn.

To describe the parameters of template Tle, the following can be used:
{{ TleT = Tle1 = parm-value12 = parm-value2...0n = parm-valuen0p1 = parm-name1p2 = parm-name2...pn = parm-namen }}


A template with only unnamed parameters may look like e.g.
{{ Example1 = parm-value12 = parm-value2...n = parm-valuen }}

or without the numbers
{{ Exampleparm-value1parm-value2...parm-valuen }}

The parameter number can be used to automatically set all position numbers where there is no parameter name.
Values can as well be empty – but it may not be a very useful template description to say nothing about a value.

With neither T nor t the default template name will be Tle.

Restriction

While the values can be specified without names, it makes no sense to specify a name without its value; at least an empty value is necessary.
Because the check for a parameter name occurs only when there is a parameter value, superfluous names without values will be ignored:

{{Tle|t=m||||p3=parameter#3}} will give {{ Mparameter#3 =  }} 0 name and (empty) value for 3rd parameter
{{Tle|t=m||||p4=superfluous}} will give {{ M }} 0 no value for the 4th parameter exists - |p4 is ignored

Problems with special characters

When a parameter value starts with either #, *, : or ; it may cause problems when the system interprets it to make a new line or a list;
{{Tle}} uses Module:Char for an automatic substitution of these characters; this can be avoided by using the Unicode notation, replacing

# by #
* by *
: by :
; by &#59;


Examples

The {{Color}} template has two unnamed parameters (1=color, 2=text) and three named parameters (bg, title and css). With
{{Tle|T=color|text color|any text|p3=bg|background color|p4=title|tooltip text|p5=css|CSS attributes}}
this synopsis is made: {{ Colortext colorany textbg = background colortitle = tooltip textcss = CSS attributes }}

{{Tle|t=C| | | | | | | | | }} will just display {{ C }}.

Without any meta-parameter, {{Tle}} just shows the template name: {{ Clr }} or {{ Clr }}.

Format example

The parameter f allows to format the display: its value precedes each parameter. The following example shows how this can be done with f=<br>{{0}}
{{ File generation description
0SVG tool = Inkscape
0W3C error count = 3
0Text as path = yes
0Graphic Lab = de
0Topic = structural formula }}

Style example

{{ Tle
0t = Template
0aaaa
0bbb.bbb.bbb.bbb
0cccccccccc
0p2 = param-B
0f = <br>{{0}}
0style = font-family:courier,monospace;font-style:normal;font-weight:normal;font-size:110%;color:#369
0style2 = font-family:condensed;font-weight:bold;font-size:112% }}

will display this description:

{{ Template
0aaaa
0param-B = bbb.bbb.bbb.bbb
0cccccccccc }}


[edit subpage]

List of templates using {{T/main}}
Code Result Notes lock

{{T|example}}

{{Example}} makes brackets part of the link

{{T0|example}}

Example just link, without the brackets

{{T1|example}}

{{Example}} inner brackets are part of the link

{{T2|example}}

{{Example}} brackets are not a part of the link

{{Tl|example}}

{{Example}} makes brackets around the link

{{Tlr|User:Example}}

{{User:Example}} like {{tl}} but for any namespace

{{Tls|example}}

{{subst:example}} no parameters, adds "subst:"
Templates showing parameters 0 Meta template {{Tle}} is easiest to parametrize.

{{Tle|T=F|p1=1|v1|p2=2|v2|p3=3|v3}}

{{ F | 1 = v1 | 2 = v2 | 3 = v3 }} describes template parameters by names and values

{{Tlx|example|1|2|3|4|5||7|8|9}}

{{example|1|2|3|4|5|7|8|...}} up to 8 parameters

{{Tlf|example|1|2|3|...up to 8}}

{{example|1|2|3|...up to 8}} up to 8 parameters, no link

{{Tlc|example|1|2|3|4|||7|up to 8|9 is ignored.}}

{{example|1|2|3|4|||7|up to 8}} up to 8 parameters, no link, <code> style

{{Tld|example|1|2||3||}}

{{example|1||2|3||}} up to 8 parameters, <code> style[clarification needed]

{{Tlsu|User:Example}}

{{subst:User:Example}} like {{Tls}}, but supporting parameters
Alternative forms 0 These ignore empty parameters.

{{Tlp|example|1|2|3|4|5||7|8|9 is ignored.}}

{{example|1|2|3|4|5|7|8}} up to 8 parameters; ignores empty parms

{{Tl2|example|p1|p2}}

{{example|p1|p2}} up to 2 parameters, <code> style

{{Tlsp|example|1|2|3|4|5|6|7|8|9}}

{{subst:example|1|2|3|4|5|6|7|8|...}} up to 8 parameters, adds linked "subst:"

{{Tlsx|example|1|2|3|4|5|6 and above are ignored.|7}}

{{subst:example|1|2|3|4|5|...}} up to 5 parameters, adds linked "subst:", <code> style

General-purpose formatting

Comparison of template-linking templates according to the styles of generated text and link produced
Text style ↓ {{tlg}} options[note 1]
to achieve text style
Link style
Linked Unlinked Linked with subst Unlinked with subst Linked including braces
{{tlg}} options[note 1]
to achieve link style
N/A DEFAULT nolink=yes subst=yes nolink=yes|subst=yes braceinside=yes
normal DEFAULT N/A
code code=yes
N/A
monospace mono=yes[note 4] N/A
N/A
plaincode plaincode=yes[note 5]
kbd[clarification needed] kbd=yes[note 6]
  1. a b c {{tlg}} is the most general template, allowing any combination of text style and/or link style options.
  2. a b c d e Prevents wrapping of text by placing it inside <span class="nowrap">...</span> tags.
  3. a b c Allows links to templates in any namespace.
  4. a b c d Displays monospaced font using <span style="font-family: monospace;">...</span>.
  5. {{tlg|plaincode=yes}} uses <code style="border: none; background-color: transparent;">...</code>.
  6. {{tlg|kbd=yes}} uses <kbd>...</kbd>.