Template:Informative template

From XenonLibrary
Revision as of 08:30, 22 June 2019 by XenonLibrary>Johan G (Slight improvement of the copy-pastable example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to 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 ==
<!-- Short description of the purpose of the template, any automatic categorization and if there is things to consider when using or maintaining the template -->
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 ==
<!-- Description of how to use the template -->
 {{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. -->

== Technical details ==
<!-- Details that may help a template user or template maintainer later.  This could for example be if the template uses PHP dates or is depending on other templates. -->

== Related templates ==
<!-- Other templates in a series of templates and/or templates with similar functionality. -->
* {{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=November 2024, 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=November 2024}}

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