Toggle menu
15
236
70
27.6K
Kenshi Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Template link/doc: Difference between revisions

Template page
No edit summary
No edit summary
Tag: Reverted
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- Categories go where indicated at the bottom of this page, please; interwikis go to Wikidata (see also: [[Wikipedia:Wikidata]]). -->
{{High-use}}
{{redirect-distinguish|Template:TI|Template:Ti}}{{Template shortcut|tl|TL|t|temp}}
<!----Categories where indicated at the bottom of this page, please; interwikis at Wikidata (see [[Wikipedia:Wikidata]])---->
{{#ifeq:{{FULLPAGENAME}} | Template:Template link | {{used in system}} {{cascade-protected template}} }}
{{Lua|Module:Parameter names example}}
The '''template link''' template is a simple [[w:Macro (computer science)|macro]] [[m:Help:template|template]] used to display a template name as a link surrounded by braces, thus showing the template name as code rather than actually invoking it. Its primary use is in instruction and documentation where it is used to refer to a template by name without invoking it.


Note that this template may be used under the name "tee-el" (tl) as well as "tee-one" (t1)— both function the same way and produce the same results. This is not true for all such visually confusing templates containing a possible 1/l mix-up as they are not interchangeable.
{{Template redirect|Generic template demo|Pnex}}


'''{{tl|Tla}}''' works exactly like {{tl|tl}} with the addition of optionally displaying '''a'''lternative label text (link label).  '''{{tl|tlg}}''' can include the use of parameters in the template (as <nowiki>{{{1}}}</nowiki>).
{{tl|Parameter names example}}&nbsp;– or, alternatively, {{tl|Generic template demo}}&nbsp;– is intended to assist [[Wikipedia:Template documentation|template documentation]] by producing a generic instance of the template that uses [[Help:Templates#Parameters|parameters' names]] as those parameters' values.
{{clear}}


==Examples==
==Example==
A short example of its use is:
An example wikitext to produce a demo for {{tl|Infobox}} (on the right):


::{{tji|tl|Example}}
{{Parameter names example |_template=Infobox |title |above |subheader |subheader2 |image |caption |header1 |label2 |data2 |label3 |data3 |header4 |data5 |data6 |below}}
:which generates
::{{tl|Example}}


Other longer examples:
<pre style="overflow:auto;">
{{Parameter names example
|_template=Infobox
|title |above |subheader |subheader2 |image |caption
|header1 |label2 |data2 |label3 |data3 |header4
|data5 |data6 |below
}}
</pre>


{| class="wikitable"
==Usage notes==
! Code
When {{tlf|Parameter names example}} is used on an immediate subpage of its target template&nbsp;– e.g. on the target template's /doc page&nbsp;– its own {{para|_template}} parameter identifying the target template may be omitted. In other words, the code above, if used on Template:Infobox/''page'' (where ''page'' could be "doc", "testcases", etc.), would become:
! Result
! Notes
|-
| {{tji|tl|Void}}
| {{tl|Void}}
| Standard usage
|-
| {{tji|tls|Example}}
| {{tls|Example}}
| For templates that should be [[Wikipedia:Substitution|substituted]]
|-
| {{tji|tl2|X1}}
| {{tl2|X1}}
| This formats the link to show how it would look in code (i.e., monospace font)
|-
| {{tji|tl2|sister: M&#58;|3x}}
| <code><nowiki>{{</nowiki>[[{{{LANG|}}}M:{{ns:Template}}:3x|3x]]<nowiki>}}</nowiki></code>
| Same as above, for templates on another Wikimedia project (in this example, Meta, using '''<code>m:</code>'''). See [[Help:Interwiki_linking#Prefix_codes_for_linking_to_Wikimedia_sister_projects|Interwiki codes]].
|-
| {{tji|tl2|sister: wikibooks|lang: de&#58;|WP}}
| <code><nowiki>{{</nowiki>[http://de.wikibooks.org/wiki/Vorlage:WP WP]<nowiki>}}</nowiki></code><!--
––––– This is currently a fraudulent output result... the template code needs modified to work
––––– per this plan, then this /doc file fixed up to match whatever the correct syntax actually is.
––––– ALMOST work:
[[:de:wikibooks:{{ns:template}}:WP|WP]]
[[de:wikibooks:{{ns:template}}:WP|WP]]
-->
| For templates on another language project
|-
| {{tji|tl|1: {{=}})}}
| {{tl|1==)}}
| Use the format <code><nowiki>{{tl|1=templatename}}</nowiki></code> if the template contains template coding characters such as {{tl|1==)}} or {{tl|1=!}}
|}


== TemplateData ==
<pre style="overflow:auto;">
{{TemplateData header}}
{{Parameter names example
<templatedata>{
|title |above |subheader |subheader2 |image |caption
"description": "This template displays a template name as a link surrounded by braces, thus showing how the template name would be used in code. Its primary use is in instruction and documentation.",
|header1 |label2 |data2 |label3 |data3 |header4
"params": {
|data5 |data6 |below
"1": {
}}
"label": "Template name",
</pre>
"description": "Positional parameter: the template name without the namespace prefix “Template:, which is added automatically",
 
"type": "wiki-template-name",
One exception to this is the "sandbox" subpage. If the module is called from a page ending in "/sandbox", it uses that page to generate the template output, not the base page. To override this behaviour you can specify the {{para|_template}} parameter explicitly.
"required": true
 
}
The formatting of the parameter names can be changed with the {{para|_display}} parameter. By default, the parameter names are shown in triple braces (the [[m:Help:Templates#Parameters|parameter standard]], e.g. {{{name}}}{{thin space}}), but if {{para|_display|italics}} or {{para|_display|italic}} is set, they are shown in italics.
},
 
"format": "inline"
A custom value for a parameter may be supplied by using {{para|[parameter name]|[value]}} in place of <code>|[parameter name]</code>. Any formatting for such a value&nbsp;– including, for instance, italics&nbsp;– must be supplied as part of the value (e.g. {{para|parameter|<nowiki>''value''<br/></nowiki>}}). Custom values cannot be used for parameters whose names begin with an underscore ("_").
}</templatedata>


== See also ==
== See also ==
* {{tiw|tl2}}
* [[Wikipedia:Template documentation]]
* {{tiw|tl}}
* [[Template:Parameters]] and [[Module:Parameters]] – generates a list of parameter names for a given template
* {{tiw|tlp}} to produce a [t]emplate [l]ink with a single [p]arameter.
* {{tiw|tlx}} to produce a [t]emplate [l]ink with an e[x]panded number of parameters.
* {{tiw|tlsp}} to produce a [t]emplate [l]ink that's [[Wikipedia:Substitution|[s]ubst:]]ituted, with a single [p]arameter.
* {{tiw|lts}}
* {{tiw|tlu}}, tl or tlp in any [[Wikipedia:Namespaces|namespace]].
* {{lcs|Internal template-link templates}}
* {{tiw|tl-r}} to produce a [t]emplate [l]ink to a template [r]edirect.
{{Template-linking templates}}


<includeonly>{{Sandbox other||
<includeonly>{{Sandbox other|
<!-- Categories go below this line, please; interwikis go to Wikidata, thank you! -->
| <!----Categories below this line, please; interwikis at Wikidata---->
[[Category:Internal template-link templates]]
[[Category:Wikipedia formatting templates]]
[[Category:Template namespace templates]]
[[Category:Documentation assistance templates]]
}}</includeonly>
}}</includeonly>

Revision as of 07:48, 17 February 2025

Template:High-use

{{Parameter names example}} – or, alternatively, {{Template:Parameter names example}} – is intended to assist template documentation by producing a generic instance of the template that uses parameters' names as those parameters' values.

Example

An example wikitext to produce a demo for {{Infobox}} (on the right):

{{{title}}}
{{{above}}}
{{{subheader}}}
{{{subheader2}}}
{{{image}}}
{{{caption}}}
{{{header1}}}
{{{label2}}}{{{data2}}}
{{{label3}}}{{{data3}}}
{{{header4}}}
{{{data5}}}
{{{data6}}}
{{{below}}}
{{Parameter names example
|_template=Infobox
|title |above |subheader |subheader2 |image |caption 
|header1 |label2 |data2 |label3 |data3 |header4 
|data5 |data6 |below
}}

Usage notes

When {{Parameter names example}} is used on an immediate subpage of its target template – e.g. on the target template's /doc page – its own |_template= parameter identifying the target template may be omitted. In other words, the code above, if used on Template:Infobox/page (where page could be "doc", "testcases", etc.), would become:

{{Parameter names example
|title |above |subheader |subheader2 |image |caption 
|header1 |label2 |data2 |label3 |data3 |header4 
|data5 |data6 |below
}}

One exception to this is the "sandbox" subpage. If the module is called from a page ending in "/sandbox", it uses that page to generate the template output, not the base page. To override this behaviour you can specify the |_template= parameter explicitly.

The formatting of the parameter names can be changed with the |_display= parameter. By default, the parameter names are shown in triple braces (the parameter standard, e.g. {{{name}}}), but if |_display=italics or |_display=italic is set, they are shown in italics.

A custom value for a parameter may be supplied by using |[parameter name]=[value] in place of |[parameter name]. Any formatting for such a value – including, for instance, italics – must be supplied as part of the value (e.g. |parameter=''value''<br/>). Custom values cannot be used for parameters whose names begin with an underscore ("_").

See also