Template:Informative template

From relax wiki
Jump to: navigation, search
The following template description is not displayed when the template is inserted in an article.

Please add documentation. See {{Informative template}} for recommendations.


The following template description is not displayed when the template is inserted in an article.

Goal

This template can be used to document a wiki template and to distinguish the documentation from the actual template.

Usage

The template is used with one variable and must be put between <noinclude></noinclude> tags.

Note Please put the <noinclude> tag right behind the intended contents of the template, as an empty line or extra spaces will alter the way the template is rendered.

Consider the following copyable example to be a recommended practice.

<noinclude>
{{Informative template|1=
__NOTOC__
== Goal ==
This template can be used to...

Adding this template to a page will automatically add [[:Category:...]] to that page.

{{icaution|Caution that might help prevent lost work, very complicated debugging etc...}}

{{inote|Note that might be helpful or lead the reader in the right direction.}}

== Usage ==
 {{obr}}'''template'''{{!}}mandatory{{!}}''optional'' {{!}}mandatory= {{!}}''optional=''{{cbr}}

; parameter:  What it does and how to use it.  This parameter is mandatory... ! optional and defaults to...

; parameter:  ...

== Examples ==
Examples using different options.

== Known issues ==
Known issues and workarounds if such are known.

== Related templates ==
* {{tl|example}}

}}

[[Category:Templates]]
</noinclude>

Documenting the parameters

Try to list the parameters primarily beginning with mandatory then optional unnamed parameters then mandatory and optional named parameters and secondarily in the order they appear in the transcluded template when used.

Pre-filled values

Parameters with values that can easily be added automatically, like for example date=December 2019, could be added to the parameter in the list of parameters, like:

 {{obr}}'''merge'''{{!}}the other page{{!}}''discussion page section'' {{!}}''date={{CURRENTMONTHNAME}} {{CURRENTYEAR}}''{{cbr}}

This will show as the easy copyable

{{merge|the other page|discussion page section |date=December 2019}}

Listing the parameters vertically

If there are many parameters, it might be a good idea to not only show them horizontally, but also vertically. Sometimes when there is a lot of parameters, for example in infobox templates, showing only a vertical listing of parameters like below is preferred.

When listing parameters vertically it often is preferable to have the values aligned with each other, as that makes it easier to read and edit the source for the page it is used on. Note the space character after the equal signs when marking the text for copying. Those might help when reading the template wiki text and template documentation.

{{template
| mandatory
| optional
| mandatory = 
| mandatory = 
| optional  = 
| optional  = 
}}

To simplify making a list like the above one, copy the below wiki text and start from there.

 {{obr}}'''template'''
 {{!}} mandatory
 {{!}} ''optional''
 {{!}} mandatory = 
 {{!}} mandatory = 
 {{!}} ''optional''  = 
 {{!}} ''optional''  = 
 {{cbr}}

Recommended sections

Please use at least the following sections:

  • Goal
  • Usage

And when applicable also use:

  • Parameters subsection in the Usage section (Often not needed if there are only one or two parameters.)
  • Examples
  • Known issues
  • Technical details
  • Related templates