Template:Tle/doc: Difference between revisions
More actions
m fix |
m +parm |
||
| Line 8: | Line 8: | ||
|2d=name of the template; Will be displayed as plain text<br><small>When parameter "T" is specified, an additional parameter "t" is ignored</small> | |2d=name of the template; Will be displayed as plain text<br><small>When parameter "T" is specified, an additional parameter "t" is ignored</small> | ||
|2stat=optional- | |2stat=optional- | ||
|3=1 … | |3=1 … n | ||
|3d=parameter value; may contain wiki syntax, if necessary | |3d=parameter value; may contain wiki syntax, if necessary | ||
|3stat=optional- | |3stat=optional- | ||
|4=p1 … | |4=p1 … pn | ||
|4d=parameter name | |4d=parameter name | ||
|4stat=optional- | |4stat=optional- | ||
| Line 17: | Line 17: | ||
|5d=possible value to format the display - see [[#Format example]] | |5d=possible value to format the display - see [[#Format example]] | ||
|5stat=optional- | |5stat=optional- | ||
|6=style | |||
|6d=possible ''display style'' modification - see [[#Style example]] | |||
|6stat=optional- | |||
|name=Tle | |name=Tle | ||
| Line 52: | Line 55: | ||
=== Restriction === | === 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.<br> | 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.<br> | ||
Because possibly parameter ''names'' are checked only when there is a parameter ''value'', superfluous ''names without values'' will be ''ignored | Because possibly parameter ''names'' are checked only when there is a parameter ''value'', superfluous ''names without values'' will be ''ignored'': | ||
:<tt><nowiki>{{Tle|t=m||||p3=parameter#3}}</nowiki></tt> will give {{Tle|t=m||||p3=parameter#3}} | :<tt><nowiki>{{Tle|t=m||||p3=parameter#3}}</nowiki></tt> will give {{Tle|t=m||||p3=parameter#3}} | ||
:<tt><nowiki>{{Tle|t=m||||p4=superfluous}}</nowiki></tt> will give {{Tle|t=m||||p4=superfluous}} | :<tt><nowiki>{{Tle|t=m||||p4=superfluous}}</nowiki></tt> will give {{Tle|t=m||||p4=superfluous}} | ||
| Line 87: | Line 90: | ||
|p5=Topic|structural formula | |p5=Topic|structural formula | ||
|f=<br>{{0}}}}}}<br> | |f=<br>{{0}}}}}}<br> | ||
=== Style example === | |||
{{Tle|T=Tle | |||
|p1=t|Template | |||
|aaaa|bbb.bbb.bbb.bbb|cccccccccc | |||
|p5=p2|param-B | |||
|p6=f|<nowiki><br>{{0}}</nowiki> | |||
|p7=style|font-family:courier,monospace;font-style:normal;font-weight:normal;font-size:110% | |||
|p8=style2|font-family:condensed;font-weight:bold;font-size:112% | |||
|style=font-family:courier,monospace | |||
|f=<br>{{0}}}} | |||
will display this description: | |||
{{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% | |||
|style2=font-family:condensed;font-weight:bold;font-size:112%}} | |||
{{Commons:Link templates/Template links}} | {{Commons:Link templates/Template links}} | ||
Revision as of 06:24, 28 July 2020
Meta template for template description. Describes template parameters
Usage
{{Tle |T= }}
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
T | name of the template; Will be displayed as linkable item | 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; may contain wiki syntax, if necessary | empty | optional | |
p1 … pn | parameter name | empty | optional | |
f | possible value to format the display - see #Format example | 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: all namespaces
The template is intended to be used by the following user groups: all users == Localization ==
The template does not generate any localizable text.
Explanation
It is necessary to distinguish between a template and its parameter names and parameter values, and this meta-template with its meta-parameter-names and meta-parameter-values.
Wikimedia Commons has lots of other template 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...p25 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 }}
Values can as well be empty - but it may not be a very useful template description to say nothing about a value.
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 possibly parameter names are checked 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 = }}
- {{Tle|t=m||||p4=superfluous}} will give {{ M }}
Problems with special characters
When a parameter value starts wih either #, *, ; or : it may cause problems when the system interprets it to make a new line or list;
{{Tle}} checks for these characters and automatically tags it with nowiki.
This may cause another problem when the value contains e.g. a wikilink.
To avoid that automatic tagging, the Unicode notation can be used: replace
- # by #
- * by *
- : by :
- ; by ;
Examples
The template:{{Color}} 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 description 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 }}.
With neither T nor t the default template name will be Tle.
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%
| 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}}