FANDOM


Acorn 5
This page in a nutshell:
When you create a template, if it's anything more than some static wikicode, document it. Other editors will be less confused.

Templates are very often used on the RuneScape Wiki, and they can be anything from static wikicode, shown on a page whenever it's placed on it, to extremely complex calculations and dynamic tables.

When you create a template, you may have it use parameters to insert some text defined by the editor who uses your template, or have it use magic words so it acts differently according to the page it's used on. If your template uses parameters or magic words – anything beyond just displaying text –, you need to document it.

Basic templates don't need documentation Edit

If, when an editor invokes a template, what's shown never changes under any circumstances, the template's page may simply show this content without any usage information. An editor then knows that he or she can use the template by entering its name, enclosed in {{ and }}.

Documentation Edit

To create a template's documentation page, go to the template's page, for example Template:Sandbox, and add /doc at the end of the URL. You will then be ready to edit the documentation page.

Marking the documentation page Edit

The first thing in a template documentation page should be a transclusion of the {{Documentation}} template, which has the effect of marking the documentation page as such on the page of the template to be documented.

See Documentation's documentation here.

High-level summary Edit

The next thing should be a high-level summary of the template's results. For example, "Template:Example displays a table of all available Dungeoneering items made with a certain material."

Parameter descriptions Edit

Templates that use parameters need to have a summary of how to specify and use each of the parameters. A template's parameters may be numbered or named, or both. Additionally, the value may need to be in a certain format for the template to use it; this format also needs to be mentioned. Template:Coins, for example, expects its parameter to have no commas.

Numbered parameters Edit

Template:FloorNumber is an example of a template that uses a numbered parameter. Since it has only one numbered parameter, it does not need to specify which parameter comes first, but its documentation needs to state that the parameter has no name= prefix. Otherwise, an editor could try {{FloorNumber|floor=1}} and fail to produce the correct result.

See FloorNumber's documentation here.

Named parameters Edit

Most infobox templates on the wiki are examples of templates that use named parameters. Each parameter produces a cell in the infobox's table, and their order doesn't matter, only their presence in the parameter list. The function of each named parameter should be in its own section in the documentation page. The name of the section should match the name of the parameter; for example, documenting {{Foo|bar=baz{{ would be at Template:Foo/doc, starting with == bar ==.

See Infobox Item's documentation here.

Templates with lots of named parameters Edit

If a template has a lot of named parameters, like Template:Infobox Item, it may be helpful to provide an invocation of the template with all of its parameters already present but not filled in, inside a <pre> tag. This way, an editor who knows what the template's name is but not all of its parameters can visit its page and copy-paste an invocation on a page.

Preloads Edit

Another helpful tool to provide if a template has lots of named parameters is a preload for the template. Useful preloads include infoboxes or citation templates. A list of currently available template preloads can be seen here.

Template preloads are required to be on a preload subpage, for example {{Template:Infobox Quest/preload}}. This contains what will appear when the template is preloaded. For Infobox Quest this would be:

{{Infobox Quest
| name =
| image = 
| aka =
| release =
| update =
| members =
| series =
| difficulty =
| length =
| number = 
| developer =
}}

It is preferable to explain what should be used for each parameter to make it easier to fill in when preloaded, although this is not mandatory.

Preload subpages should not be categorised directly. Instead use {{PreloadPage}} on the parent page. In the case of the above example this would be Template:Infobox Quest instead of Template:Infobox Quest/preload.

Usage examples Edit

Templates with parameters should have, following the description of each parameter, a few examples to demonstrate the combinations available and the results they produce.

For example, Template:Block can accept a numbered parameter, but its presence is not required; Template:Closure, to request the closure of a discussion, can accept one or two parameters, and the meaning of its first parameter is special when it is in a list of recognised words.

See Block's documentation and Closure's documentation.

Exceptions Edit

Some templates are unique in that they do not need their own documentation subpage or should have a different formatting than the usual documentation, due to unique circumstances surrounding these templates. In these cases, the following exceptions will apply.

Userboxes Edit

Userboxes should link to the userbox template documentation. This is due to the fact that all documentation for userboxes would essentially be the same. Linking to their parent template's documentation allows a uniform format for them. In these cases, the following code should be used.

<noinclude>{{Userbox/doc}}</noinclude>

Navboxes Edit

Navboxes do not need their own documentation. Navboxes do not change, and only display a navigational template. As a result, they should not have their own documentation.

Signatures Edit

Signatures are similar to userboxes, in that they should have a uniform documentation. However, signatures tend to change on a semi-regular basis, and only display a line of text. As a result, signatures should not have their own documentation.

Documentation Edit

Documentation subpages are technically templates themselves. However, they should not have their own documentation. Doing so would result in an infinite number of subpages.

Linking the documentation and the template Edit

After you are done creating a template documentation page (i.e. a /doc subpage), go back to the template itself and add this to its wikicode:

<noinclude>{{/doc}}</noinclude>

This will show the "Template documentation" section under the template.

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.