Template:Informative template: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(+ known issues section in the copyable example; etc)
(Recommending Template:Icaution and Template:Inote)
Line 24: Line 24:
Adding this template to a page will automatically add <nowiki>[[:Category:...]]</nowiki> to that page.
Adding this template to a page will automatically add <nowiki>[[:Category:...]]</nowiki> to that page.


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


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


== Usage ==
== Usage ==

Revision as of 00:52, 15 August 2014

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. 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 ==
 <nowiki>{{</nowiki>'''template'''<nowiki>|</nowiki>mandatory<nowiki>|</nowiki>''optional'' <nowiki>|</nowiki>mandatory= <nowiki>|</nowiki>''optional=''<nowiki>}}</nowiki>

; 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=March 2024, could be added to the parameter in the list of parameters, like:

 <nowiki>{{</nowiki>'''merge'''<nowiki>|</nowiki>the other page<nowiki>|</nowiki>''discussion page section'' <nowiki>|</nowiki>''date={{CURRENTMONTHNAME}} {{CURRENTYEAR}}''<nowiki>}}</nowiki>

This will show as the easy copyable

{{merge|the other page|discussion page section |date=March 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.

 <nowiki>{{</nowiki>'''template'''
 <nowiki>|</nowiki> mandatory
 <nowiki>|</nowiki> ''optional''
 <nowiki>|</nowiki> mandatory = 
 <nowiki>|</nowiki> mandatory = 
 <nowiki>|</nowiki> ''optional''  = 
 <nowiki>|</nowiki> ''optional''  = 
 <nowiki>}}</nowiki>

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
  • Related templates