Tesseract:Template policy

From the Tesseract Wiki, the wiki for all things Marvel Cinematic Universe
(Redirected from Tesseract:TPOL)
Jump to navigation Jump to search
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 Tesseract 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 source]

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 source]

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 source]

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 source]

The next thing should be a high-level summary of the template's results. For example, "Template:Example displays a table of all credits for Avengers: Infinity War."

Parameter descriptions[edit source]

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.

Numbered parameters[edit source]

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 source]

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 source]

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 source]

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. This contains what will appear when the template is preloaded. 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.

Usage examples[edit source]

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 source]

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 source]

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.


Navboxes[edit source]

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 source]

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 source]

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 source]

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:


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

See also[edit source]