Template:Tle: Difference between revisions
More actions
m typo |
m much simpler realized than two years ago |
||
| Line 1: | Line 1: | ||
{{ <tt>{{#if:{{{T|}}}|[[Template:{{{T}}}|{{ucfirst:{{{T}}}}}]]|{{ucfirst:{{{t|tle}}}}}}}</tt><!-- | {{ <tt>{{#if:{{{T|}}}|[[Template:{{{T}}}|{{ucfirst:{{{T}}}}}]]|{{ucfirst:{{{t|tle}}}}}}}</tt><!-- | ||
-->{{# | -->{{#switch:{{{1|×}}}|×=|{{Tle/parm|{{{p1|}}}|{{#if:{{{1|}}}|{{{1}}}| }}}}}}<!-- | ||
-->{{#switch:{{{2|×}}}|×=|{{Tle/parm|{{{p2|}}}|{{#if:{{{2|}}}|{{{2}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{3|×}}}|×=|{{Tle/parm|{{{p3|}}}|{{#if:{{{3|}}}|{{{3}}}| }}}}}}<!-- | ||
-->{{#switch:{{{4|×}}}|×=|{{Tle/parm|{{{p4|}}}|{{#if:{{{4|}}}|{{{4}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{5|×}}}|×=|{{Tle/parm|{{{p5|}}}|{{#if:{{{5|}}}|{{{5}}}| }}}}}}<!-- | ||
-->{{#switch:{{{6|×}}}|×=|{{Tle/parm|{{{p6|}}}|{{#if:{{{6|}}}|{{{6}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{7|×}}}|×=|{{Tle/parm|{{{p7|}}}|{{#if:{{{7|}}}|{{{7}}}| }}}}}}<!-- | ||
-->{{#switch:{{{8|×}}}|×=|{{Tle/parm|{{{p8|}}}|{{#if:{{{8|}}}|{{{8}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{9|×}}}|×=|{{Tle/parm|{{{p9|}}}|{{#if:{{{9|}}}|{{{9}}}| }}}}}}<!-- | ||
-->{{#switch:{{{10|×}}}|×=|{{Tle/parm|{{{p10|}}}|{{#if:{{{10|}}}|{{{10}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{11|×}}}|×=|{{Tle/parm|{{{p11|}}}|{{#if:{{{11|}}}|{{{11}}}| }}}}}}<!-- | ||
-->{{#switch:{{{12|×}}}|×=|{{Tle/parm|{{{p12|}}}|{{#if:{{{12|}}}|{{{12}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{13|×}}}|×=|{{Tle/parm|{{{p13|}}}|{{#if:{{{13|}}}|{{{13}}}| }}}}}}<!-- | ||
-->{{#switch:{{{14|×}}}|×=|{{Tle/parm|{{{p14|}}}|{{#if:{{{14|}}}|{{{14}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{15|×}}}|×=|{{Tle/parm|{{{p15|}}}|{{#if:{{{15|}}}|{{{15}}}| }}}}}}<!-- | ||
-->{{#switch:{{{16|×}}}|×=|{{Tle/parm|{{{p16|}}}|{{#if:{{{16|}}}|{{{16}}}| }}}}}}<!-- | |||
-->{{# | -->{{#switch:{{{17|×}}}|×=|{{Tle/parm|{{{p17|}}}|{{#if:{{{17|}}}|{{{17}}}| }}}}}}<!-- | ||
-->{{#switch:{{{18|×}}}|×=|{{Tle/parm|{{{p18|}}}|{{#if:{{{18|}}}|{{{18}}}| }}}}}}<!-- | |||
-->{{#switch:{{{19|×}}}|×=|{{Tle/parm|{{{p19|}}}|{{#if:{{{19|}}}|{{{19}}}| }}}}}}<!-- | |||
-->{{#switch:{{{20|×}}}|×=|{{Tle/parm|{{{p20|}}}|{{#if:{{{20|}}}|{{{20}}}| }}}}}}<!-- | |||
-->{{#switch:{{{21|×}}}|×=|{{Tle/parm|{{{p21|}}}|{{#if:{{{21|}}}|{{{21}}}| }}}}}}<!-- | |||
-->{{#switch:{{{22|×}}}|×=|{{Tle/parm|{{{p22|}}}|{{#if:{{{22|}}}|{{{22}}}| }}}}}}<!-- | |||
-->{{#switch:{{{23|×}}}|×=|{{Tle/parm|{{{p23|}}}|{{#if:{{{23|}}}|{{{23}}}| }}}}}}<!-- | |||
-->{{#switch:{{{24|×}}}|×=|{{Tle/parm|{{{p24|}}}|{{#if:{{{24|}}}|{{{24}}}| }}}}}}<!-- | |||
-->{{#switch:{{{25|×}}}|×=|{{Tle/parm|{{{p25|}}}|{{#if:{{{25|}}}|{{{25}}}| }}}}}}<!-- | |||
--> }}<noinclude> | --> }}<noinclude> | ||
{{Documentation}} | {{Documentation}} | ||
</noinclude> | </noinclude> | ||
Revision as of 14:29, 7 June 2019
{{ Tle }}
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
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
T | Name of the template, which will be displayed as a link | Tle | optional | |
t | name of the template; Will be displayed as plain text When parameter "T" is specified, an additional parameter "t" is ignored | empty | optional | |
1 … n | parameter value(s); may contain wiki syntax, if necessary | empty | optional | |
p1 … pn | parameter name(s)[Please clarify – October 2024] (none for positional parameters) | empty | optional | |
f | Separator between parameters to format the display - see #Format example | empty | optional | |
number | any value: show the default numbers of positional parameters | empty | optional | |
kbd | any value: displays parameter names with fixed-pitch font | empty | optional | |
style | possible display style modification - see #Style example | empty | optional | |
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
{{Showname}} to see all parameters and values of a template transclusion
== Localization ==
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:
{{ Tle | T = Tle | 1 = parm-value1 | 2 = parm-value2 | ... | n = parm-valuen | p1 = parm-name1 | p2 = parm-name2 | ... | pn = parm-namen }}
A template with only unnamed parameters may look like e.g.
{{ Example | 1 = parm-value1 | 2 = parm-value2 | ... | n = parm-valuen }}
or without the numbers
{{ Example | parm-value1 | parm-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 {{ M | | | parameter#3 = }} name and (empty) value for 3rd parameter{{Tle|t=m||||p4=superfluous}}will give {{ M | | | }} no value for the 4th parameter exists -|p4is 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 ;
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: {{ Color | text color | any text | bg = background color | title = tooltip text | css = 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 | SVG tool = Inkscape | W3C error count = 3 | Text as path = yes | Graphic Lab = de | Topic = structural formula }}
Style example
{{ Tle | t = Template | aaaa | bbb.bbb.bbb.bbb | cccccccccc | p2 = param-B | f = <br>{{0}} | style = font-family:courier,monospace;font-style:normal;font-weight:normal;font-size:110%;color:#369 | style2 = font-family:condensed;font-weight:bold;font-size:112% }}
will display this description:
{{ Template | aaaa | param-B = bbb.bbb.bbb.bbb | cccccccccc }}
{{Commons:Link templates/Template links}}