Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Tle/doc: Difference between revisions

Template page
m format
flag 4 as unclear. clarify f
 
(25 intermediate revisions by 7 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=name of the template; Will be displayed as linkable item
|1d=Name of the template, which will be displayed as a link
|1def=<tt>Tle</tt>
|1def=<code>Tle</code>
|1stat=optional  
|1stat=optional  
|2=t
|2=t
|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 … 25
|3=1&nbsp; n
|3d=parameter value; may contain wiki syntax, if necessary
|3d=parameter value(s); may contain wiki syntax, if necessary
|3stat=optional-
|3stat=optional-
|4=p1&nbsp;…&nbsp;p25
|4=p1&nbsp;…&nbsp;pn
|4d=parameter name
|4d=parameter name(s){{Clarify|date=October 2024}} &nbsp; <small>(none for positional parameters)</small>
|4stat=optional-
|4stat=optional-
|5=f
|5d=Separator between parameters to format the display - see [[#Format example]]
|5stat=optional-
|6=number
|6d=any value: show the default numbers of positional parameters
|6stat=optional-
|7=kbd
|7d=any value: displays parameter names with <kbd>fixed-pitch</kbd> font
|7stat=optional-
|8=style
|8d=possible ''display style'' modification - see [[#Style example]]
|8stat=optional-


|name=Tle
|name=Tle
|desc=<u>Meta template</u> for template description.
|desc={{Lua|Module:Iteration}}Displays Wikitext to invoke a template
Describes<!-- and explanes--> template parameters
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=all
|namespace=template
|usergroup=all
|usergroup=template editor
|usage-notes=
|usage-notes=
|seealso=
|seealso={{T|Para}}
 
{{T|Showname}} to see all parameters and values of a template transclusion
}}
}}
== Explanation ==
== 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 templates to document templates, but none is really able to describe complicated parametrizing easily.  


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 <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>
 
For unnamed parameters this name can be the number; if even that is not needed, some or all meta-parameter ''names'' may dismiss.
In general, each parameter is described with a meta-pair <code>|pn= |n= </code>, an ''optional'' meta-parameter p1...p16 for the name and an ''optional'' unnamed meta-parameter for the value.<br>
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 ==
== 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 p{{smallsub|n}}.  
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 p{{smallsub|n}}.  


To describe the parameters of template <tt>Tle</tt>, 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|template-name|parm-value1|parm-value2 &#124; ...|parm-value{{Smallsub|n}}|p2=1|p3=2|p4=n
{{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 &#124; ...|parm-name{{Smallsub|n}}|p5=p1|p6=p2|p7=p{{Smallsub|n}}}}
|parm-name1|parm-name2 | ... |parm-name{{Smallsub|n}}|p5={{0}}n|p6=p1|p7=p2|p9=p{{#tag:span|n|style=vertical-align:sub}}}}
 


A template with only unnamed parameters may look like e.g.<br>
A template with only unnamed parameters may look like e.g.<br>
{{Tle|t=example|p1=1|parm-value1|p2=2|parm-value2 &#124; ...|p3=n|parm-value{{Smallsub|n}}}}
{{Tle|t=example|p1=1|parm-value1|p2=2|parm-value2 | ... |p4=n|parm-value{{#tag:span|n|style=vertical-align:sub}}}}
   
   
or without the numbers<br>
or without the numbers<br>
{{Tle|t=example|parm-value1|parm-value2 &#124; ...|parm-value{{Smallsub|n}}}}
{{Tle|t=example|parm-value1|parm-value2 |...|parm-value{{#tag:span|n|style=vertical-align:sub}}}}


Values can as well be empty - even if it is ''not'' a very useful template description to say nothing about a value.  
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.
 
With neither <code>T</code> nor <code>t</code> the default template name will be <code>Tle</code>.


=== Restriction ===
=== Restriction ===
While the values can be specified without names, it makes no sense to specify a name without his value; at least an empty value is necessary.  
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>
Superfluous names without values will be ignored:
Because the check for a parameter ''name'' occurs 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}}
:<code><nowiki>{{Tle|t=m||||p3=parameter#3}}</nowiki></code>  will give {{Tle|t=m||||p3=parameter#3}} {{0}} name ''and'' (empty) value for 3{{exp|rd}} parameter
:<tt><nowiki>{{Tle|t=m||||p4=superfluous}}</nowiki></tt>  will give {{Tle|t=m||||p4=superfluous}}
:<code><nowiki>{{Tle|t=m||||p4=superfluous}}</nowiki></code>  will give {{Tle|t=m||||p4=superfluous}} {{0}} no value for the 4{{exp|th}} parameter exists - {{para||p4}} is ignored
=== Problems with special characters ===
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;
this can be avoided by using the Unicode notation,  replacing
: {{T\|#}} by &amp;#35;
: {{T\|*}} by &amp;#42;
: {{T\|:}} by &amp;#58;
: {{T\|;}} by &amp;#59;
 


== Examples ==
== Examples ==
The {{T1|Color|+|case=l}} has two unnamed parameters (1=''color'', 2=''text'') and three named parameters (bg, title and css). With <br>
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 description is made:  {{Tle|T=color|text color|any text|p3=bg|background color|p4=title|tooltip text|p5=css|CSS attributes}}
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>
With neither <code>T</code> nor <code>t</code> the default template name will be <tt>Tle</tt>.
 
=== Format example ===
The parameter <code>f</code> allows to format the display: its value precedes each parameter. The following example shows how this can be done with <code><nowiki>f=<br>{{0}}</nowiki></code>
<br>{{Color|b|bg=#DFD|
{{Tle|t=File generation description
|p1=SVG tool|Inkscape
|p2=W3C error count|3
|p3=Text as path|yes
|p4=Graphic Lab|de
|p5=Topic|structural formula
|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%;color:#369
|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%;color:#369
|style2=font-family:condensed;font-weight:bold;font-size:112%}}
 


{{Commons:Link templates/Template links}}
{{Commons:Link templates/Template links}}

Latest revision as of 19:56, 25 October 2024

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)[Please clarify – October 2024]   (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

== 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:
{{ 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 &#35;
* by &#42;
: by &#58;
; 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 }}


{{Commons:Link templates/Template links}}

Cookies help us deliver our services. By using our services, you agree to our use of cookies.