Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
DOORS Site Logo

Welcome to the Official DOORS Wiki!
Please read the Wiki Rules the Manual of Style and familiarise yourself with our Wiki Policies before contributing to get a better understanding of what content is allowed on our wiki and how to display it properly, if you need help don't hesitate to reach out to a DOORS Wiki Staff Member.

Template:T/doc: Difference between revisions

Template page
No edit summary
 
m (Updated red link.)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>{{Documentation subpage}}</noinclude>
;Description
== Description ==
A template link with a variable number of parameters (0-20).
This is a template link with a variable number of example parameters (0–30), which can be used to show example inputs.
== Parameters ==
;First parameter
:The link to the template. Defaults to the page name (current page name: '''{{PAGENAME}}''')
:
;2nd to 31st parameter
:The parameters of the demo template.
:
:To add ''named parameters'', example <code><nowiki>{{Icons|1st parameter|2nd parameter|text=3rd parameter}}</nowiki></code>, follow these steps:
:# Write the parameter normally. Example: <code><nowiki>{{T|Icons|1st parameter|2nd parameter|text=3rd parameter}}</nowiki></code>.
:# Then, count how many parameters you have added, so <code>{<nowiki/>{T|''Icons''|''1st parameter''|''2nd parameter''|'''text=3rd parameter'''}}</code>. <br/> On this example, there are '''4''' parameters, so prefix <code>4=</code> on the {{T|T}} template.
:# So, the code is <code>{<nowiki/>{T|Icons|1st parameter|2nd parameter|'''''4='''text=3rd parameter''}}</code>, which results in {{T|Icons|1st parameter|2nd parameter|4=text=3rd parameter}}.
:
:Note: Adding named parameters will force you to always prefix the unnamed parameter:
::<code><nowiki>{{T|Icons|1st parameter|2nd parameter|4=3=3rd parameter|4th parameter}}</nowiki></code> will '''not work'''.
::<code><nowiki>{{T|Icons|1st parameter|2nd parameter|4=3=3rd parameter|5=4th parameter}}</nowiki></code> '''will work'''.
----
The following will only work after all the parameters of the demo template is placed.<br/>
'''Wrong''': <nowiki>{{T|Icons|style=code|<message>}}</nowiki><br/>
'''Right''': <nowiki>{{T|Icons|<message>|style=code}}</nowiki>


;Style (<code>style=</code>)
;Syntax
:The style of the {{T|T}} template. Has 3 styles:
:{{t|t|parameter1|parameter2|parameter3|parameter4|...|parameter20}} <!-- self-referential examples! -->
:* (none) - encloses the {{T|T}} template with <code><nowiki><code></nowiki></code>
:* <code>plain</code> - encloses the {{T|T}} template with <code><nowiki><span></nowiki></code>
:* <code>code</code> - encloses the {{T|T}} template with <code><nowiki><code></nowiki></code> and adds styling to the code element.
:* <code>pre</code> - encloses the {{T|}} template with a HTML <code><nowiki><pre></nowiki></code> tag.
:
;Prefix (<code>prefix=</code>)
:A prefix ''before'' the template link, useful when instructing the user to add <code>subst</code>, <code>safesubst</code>, or something similar. The output will be similar to: <code><nowiki>prefix:[[template link]]</nowiki></code>
:Note: This '''does not''' add a prefix to the link itself. Use <code>linkprefix</code> instead as listed below.
:
;Link Prefix (<code>linkprefix=</code>)
:A prefix ''added to'' the template link, for linking to other languages or wikis. <code><nowiki>[[linkprefix:template link]]</nowiki></code>
:Note: This adds the prefix to the link itself. To add a prefix not included on the link, see above.
:
;Block Mode (<code>block=</code>)
:Makes the template styled as a block template, to aid in readablity. Combine with <code>style=pre</code> to get the best results.


=== Parameter limit ===
;Source
This template has a parameter limit of 30 items. If you exceed that limit, this will show up:
:Improved version not needing t/piece subtemplate developed on [http://templates.fandom.com Templates wiki] see the [http://templates.fandom.com/index.php?title=Template:T&action=history list of authors]. Copied here via CC-By-SA 3.0 license.
:<span class="error">Template parameter limit reached! ([[Template:T#Parameter limit|help]])</span>


You can remove this warning and add more parameter checks to the template, however this might take some time depending on how many parameters you want.
;Example
:{{t|t|param1|param2}}


If you want unlimited parameters alongside other features, please see [[w:c:dev:Global Lua Modules/T]].
<includeonly>[[Category:General wiki templates]]</includeonly>

<noinclude>[[Category:Template documentation]]</noinclude>
== Examples ==
=== Basic ===
{| class="wikitable"
! Syntax
! Output
|-
| <code><nowiki>{{T}}</nowiki></code>
| {{T}} (uses the page name)
|-
| <code><nowiki>{{T|Icons}}</nowiki></code>
| {{T|Icons}}
|-
| <code><nowiki>{{T|Icons|Item1|Item2|Item3|Item4|Item5|...}}</nowiki></code>
| {{T|Icons|Item1|Item2|Item3|Item4|Item5|...}}
|}

=== Named parameters ===
{| class="wikitable"
! Syntax
! Output
|-
| <code><nowiki>{{T|Icons|2=param1=Item1}}</nowiki></code>
| {{T|Icons|2=param1=Item1}}
|-
| <code><nowiki>{{T|Icons|2=param1=Item1|3=param2=Item2}}</nowiki></code>
| {{T|Icons|2=param1=Item1|3=param2=Item2}}
|-
| <code><nowiki>{{T|Icons|example|3=param1=Item1|4=param2=Item2}}</nowiki></code>
| {{T|Icons|example|3=param1=Item1|4=param2=Item2}}
|}

=== Prefixes ===
{| class="wikitable"
! Syntax
! Output
|-
| <code><nowiki>{{T|Icons|prefix=subst}}</nowiki></code>
| {{T|Icons|prefix=subst}}
|-
| <code><nowiki>{{T|Icons|linkprefix=w}}</nowiki></code>
| {{T|Icons|linkprefix=w}}
|-
| <code><nowiki>{{T|Icons|linkprefix=w|prefix=subst}}</nowiki></code>
| {{T|Icons|linkprefix=w|prefix=subst}}
|}

=== Styling ===
{| class="wikitable"
! Syntax
! Output
|-
! colspan="2" | Normal
|-
| <code><nowiki>{{T|Icons|style=code}}</nowiki></code>
| {{T|Icons|style=code}}
|-
| <code><nowiki>{{T|Icons|style=plain}}</nowiki></code>
| {{T|Icons|style=plain}}
|-
| <code><nowiki>{{T|Icons|2=Item1|3=Item2|4=Item3|style=pre}}</nowiki></code>
| {{T|Icons|2=Item1|3=Item2|4=Item3|style=pre}}
|-
! colspan="2" | With <code>block=</code>
|-
| <code><nowiki>{{T|Icons|style=code|block=yes}}</nowiki></code>
| {{T|Icons|style=code|block=yes}}
|-
| <code><nowiki>{{T|Icons|style=plain|block=yes}}</nowiki></code>
| {{T|Icons|style=plain|block=yes}}
|-
| <code><nowiki>{{T|Icons|2=Item1|3=Item2|4=Item3|style=pre|block=yes}}</nowiki></code>
| {{T|Icons|2=Item1|3=Item2|4=Item3|style=pre|block=yes}}
|}

=== Full usage ===
<code><nowiki>
{{T|Icons|2=param1=Item1|3=param2=Item2|4=param3=Item3<br/>...|5=param10=Item10|block=true|style=pre|prefix=subst}}
</nowiki></code>
{{T|Icons|2=param1=Item1|3=param2=Item2|4=param3=Item3<br/>...|5=param10=Item10|block=true|style=pre|prefix=subst}}

== See also ==
* [[w:c:templates:Template:T3|T3]] (uses [[w:c:dev:Global Lua Modules/T|Dev:T]])

<includeonly>[[Category:Internal link templates]]</includeonly>

Latest revision as of 05:01, 18 September 2022

Edit-copy green.svg
This is a template documentation subpage for Template:T.
It contains usage information, categories, interlanguage links and other content that is not part of the original template page.

Description[edit source]

This is a template link with a variable number of example parameters (0–30), which can be used to show example inputs.

Parameters[edit source]

First parameter
The link to the template. Defaults to the page name (current page name: T/doc)
2nd to 31st parameter
The parameters of the demo template.
To add named parameters, example {{Icons|1st parameter|2nd parameter|text=3rd parameter}}, follow these steps:
  1. Write the parameter normally. Example: {{T|Icons|1st parameter|2nd parameter|text=3rd parameter}}.
  2. Then, count how many parameters you have added, so {{T|Icons|1st parameter|2nd parameter|text=3rd parameter}}.
    On this example, there are 4 parameters, so prefix 4= on the {{T}} template.
  3. So, the code is {{T|Icons|1st parameter|2nd parameter|4=text=3rd parameter}}, which results in {{Icons|1st parameter|2nd parameter|text=3rd parameter}}.
Note: Adding named parameters will force you to always prefix the unnamed parameter:
{{T|Icons|1st parameter|2nd parameter|4=3=3rd parameter|4th parameter}} will not work.
{{T|Icons|1st parameter|2nd parameter|4=3=3rd parameter|5=4th parameter}} will work.

The following will only work after all the parameters of the demo template is placed.
Wrong: {{T|Icons|style=code|<message>}}
Right: {{T|Icons|<message>|style=code}}

Style (style=)
The style of the {{T}} template. Has 3 styles:
  • (none) - encloses the {{T}} template with <code>
  • plain - encloses the {{T}} template with <span>
  • code - encloses the {{T}} template with <code> and adds styling to the code element.
  • pre - encloses the {{[[Template: |]]}} template with a HTML <pre> tag.
Prefix (prefix=)
A prefix before the template link, useful when instructing the user to add subst, safesubst, or something similar. The output will be similar to: prefix:[[template link]]
Note: This does not add a prefix to the link itself. Use linkprefix instead as listed below.
Link Prefix (linkprefix=)
A prefix added to the template link, for linking to other languages or wikis. [[linkprefix:template link]]
Note: This adds the prefix to the link itself. To add a prefix not included on the link, see above.
Block Mode (block=)
Makes the template styled as a block template, to aid in readablity. Combine with style=pre to get the best results.

Parameter limit[edit source]

This template has a parameter limit of 30 items. If you exceed that limit, this will show up:

Template parameter limit reached! (help)

You can remove this warning and add more parameter checks to the template, however this might take some time depending on how many parameters you want.

If you want unlimited parameters alongside other features, please see w:c:dev:Global Lua Modules/T.

Examples[edit source]

Basic[edit source]

Syntax Output
{{T}} {{T/doc}} (uses the page name)
{{T|Icons}} {{Icons}}
{{T|Icons|Item1|Item2|Item3|Item4|Item5|...}} {{Icons|Item1|Item2|Item3|Item4|Item5|...}}

Named parameters[edit source]

Syntax Output
{{T|Icons|2=param1=Item1}} {{Icons|param1=Item1}}
{{T|Icons|2=param1=Item1|3=param2=Item2}} {{Icons|param1=Item1|param2=Item2}}
{{T|Icons|example|3=param1=Item1|4=param2=Item2}} {{Icons|example|param1=Item1|param2=Item2}}

Prefixes[edit source]

Syntax Output
{{T|Icons|prefix=subst}} {{subst:Icons}}
{{T|Icons|linkprefix=w}} {{w:Icons}}
{{T|Icons|linkprefix=w|prefix=subst}} {{subst:w:Icons}}

Styling[edit source]

Syntax Output
Normal
{{T|Icons|style=code}} {{Icons}}
{{T|Icons|style=plain}} {{Icons}}
{{T|Icons|2=Item1|3=Item2|4=Item3|style=pre}}
{{Icons|Item1|Item2|Item3}}
With block=
{{T|Icons|style=code|block=yes}} {{Icons
}}
{{T|Icons|style=plain|block=yes}} {{Icons
}}
{{T|Icons|2=Item1|3=Item2|4=Item3|style=pre|block=yes}}
{{Icons
|Item1
|Item2
|Item3
}}

Full usage[edit source]

{{T|Icons|2=param1=Item1|3=param2=Item2|4=param3=Item3<br/>...|5=param10=Item10|block=true|style=pre|prefix=subst}}

{{subst:Icons
|param1=Item1
|param2=Item2
|param3=Item3
...
|param10=Item10
}}

See also[edit source]