Template:Tle/doc: Difference between revisions
Template page
More actions
m format |
flag 4 as unclear. clarify f |
||
| (6 intermediate revisions by 3 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Mbox | |||
|text = This documentation is unclear and probably inaccurate. It should be reviewed. <!-- Chealer 2024-10 --> | |||
|type = style | |||
}} | |||
{{Mbox | |||
|text = This template ({{T|{{BASEPAGENAME}}}}) allows to document different templates. To avoid confusion, when reading the following documentation, it is necessary to distinguish this template and its (meta-)parameters from the templates it documents and their parameters. | |||
|type = content <!-- Would a different type be more appropriate? Chealer 2024-10 --> | |||
}} | |||
{{TemplateBox | {{TemplateBox | ||
|1=T | |1=T | ||
|1d= | |1d=Name of the template, which will be displayed as a link | ||
|1def=<code>Tle</code> | |1def=<code>Tle</code> | ||
|1stat=optional | |1stat=optional | ||
| Line 12: | Line 20: | ||
|3stat=optional- | |3stat=optional- | ||
|4=p1 … pn | |4=p1 … pn | ||
|4d=parameter name(s) <small>(none for positional parameters)</small> | |4d=parameter name(s){{Clarify|date=October 2024}} <small>(none for positional parameters)</small> | ||
|4stat=optional- | |4stat=optional- | ||
|5=f | |5=f | ||
|5d= | |5d=Separator between parameters to format the display - see [[#Format example]] | ||
|5stat=optional- | |5stat=optional- | ||
|6=number | |6=number | ||
| Line 28: | Line 36: | ||
|name=Tle | |name=Tle | ||
|desc={{Lua|Module:Iteration}} | |desc={{Lua|Module:Iteration}}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. | |||
|i18n-desc=The template does not generate any localizable text. | |i18n-desc=The template does not generate any localizable text. | ||
|namespace=template | |namespace=template | ||
| Line 39: | Line 47: | ||
}} | }} | ||
== Explanation == | == Explanation == | ||
Wikimedia Commons has lots of other templates to document templates, but none is really able to describe complicated parametrizing easily. | |||
Wikimedia Commons has lots of other | |||
{{Tle}} describes each parameter as a meta-pair <code>|pn= |n= </code>, an ''optional'' meta-parameter p{{sub|1}}...p{{sub|n}} for the name and an ''optional'' unnamed meta-parameter for the value.<br> | {{Tle}} describes each parameter as a meta-pair <code>|pn= |n= </code>, an ''optional'' meta-parameter p{{sub|1}}...p{{sub|n}} for the name and an ''optional'' unnamed meta-parameter for the value.<br> | ||
| Line 50: | Line 56: | ||
To describe the parameters of template <code>Tle</code>, the following can be used:<br> | To describe the parameters of template <code>Tle</code>, the following can be used:<br> | ||
{{Tle|T=Tle|p1=T|Tle|parm-value1|parm-value2 | ... |parm-value{{#tag:span|n|style=vertical-align:sub}}{{0}}|p2=1|p3=2 | {{Tle|T=Tle|p1=T|Tle|parm-value1|parm-value2 | ... |parm-value{{#tag:span|n|style=vertical-align:sub}}{{0}}|p2=1|p3=2 | ||
|parm-name1|parm-name2 | ... |parm-name{{Smallsub|n}}|p5={{0}}n|p6=p1|p7=p2|p9=p{{#tag:span|n|style=vertical-align:sub}}}} | |parm-name1|parm-name2 | ... |parm-name{{Smallsub|n}}|p5={{0}}n|p6=p1|p7=p2|p9=p{{#tag:span|n|style=vertical-align:sub}}}} | ||
| Line 61: | Line 67: | ||
The parameter <code>number</code> can be used to automatically set all position numbers where there is no parameter name.<br> | The parameter <code>number</code> can be used to automatically set all position numbers where there is no parameter name.<br> | ||
Values can as well be empty – but it may ''not'' be a very useful template description to say nothing about a value. | Values can as well be empty – but it may ''not'' be a very useful template description to say nothing about a value. | ||
With neither <code>T</code> nor <code>t</code> the default template name will be <code>Tle</code>. | |||
=== Restriction === | === Restriction === | ||
| Line 70: | Line 78: | ||
=== Problems with special characters === | === Problems with special characters === | ||
When a parameter value starts | When a parameter value starts with either <code>#</code>, <code>*</code>, <code>:</code> or <code>;</code> it may cause problems when the system interprets it to make a new line or a list;<br> | ||
{{T|Tle}} uses {{M|Char|+}} for an ''automatic substitution'' of these characters; | {{T|Tle}} uses {{M|Char|+}} for an ''automatic substitution'' of these characters; | ||
this can be avoided by using the Unicode notation, replacing | this can be avoided by using the Unicode notation, replacing | ||
| Line 80: | Line 88: | ||
== Examples == | == Examples == | ||
The {{ | The {{T|Color}} template has two unnamed parameters (1=''color'', 2=''text'') and three named parameters (<code>bg</code>, <code>title</code> and <code>css</code>). With <br> | ||
<code><nowiki>{{Tle|T=color|text color|any text|p3=bg|background color|p4=title|tooltip text|p5=css|CSS attributes}}</nowiki></code><br> | <code><nowiki>{{Tle|T=color|text color|any text|p3=bg|background color|p4=title|tooltip text|p5=css|CSS attributes}}</nowiki></code><br> | ||
this | this synopsis is made: {{Tle|T=color|text color|any text|p3=bg|background color|p4=title|tooltip text|p5=css|CSS attributes}} | ||
<nowiki>{{Tle|t=C| | | | | | | | | }}</nowiki> will just display {{Tle|t=C| | | | | | | | | }} | <code><nowiki>{{Tle|t=C| | | | | | | | | }}</nowiki></code> will just display {{Tle|t=C| | | | | | | | | }}. | ||
Without any meta-parameter, {{Tl|Tle|incl=0}} just shows the template name: {{Tle|T=clr}} or {{Tle|t=clr}}.<br> | Without any meta-parameter, {{Tl|Tle|incl=0}} just shows the template name: {{Tle|T=clr}} or {{Tle|t=clr}}.<br> | ||
=== Format example === | === Format example === | ||