Template:Documentation/doc

From The TMS Wiki
Jump to: navigation, search


This is the {{documentation}} template.

For most of the instructions about how and when to use this template, see Wikipedia:Template documentation. In general it should be used on all templates that have instructions and information regarding when and how to use that specific template.

This template displays a green doc box like you are seeing now, and automatically loads the content from a subpage called /doc. It can also load the content from other places if instructed to.

This template is intended to provide instructions on how to use templates and other pages which are transcluded onto other pages. It can be used in template space and most other namespaces.

Usage

Normally to use this page simply place the following at the bottom of a template page. Normally this template is used without any parameters, placed at the bottom of the template or page being documented, within $altnoinclude>:

<!--Last line of your template code--><noinclude>

{{documentation}}
</noinclude>

This template automatically loads the content located on the /doc subpage of the template it is used on.

If someone one wanted to add instructions on how to use Template:GenericBox, they would go to the page Template:GenericBox and enter <noinclude>{{documentation}}</noinclude> to the bottom of that page. They would then go to Template:GenericBox/doc and enter the instructions on how to use the template on that sub-page. This template will then take the text found on Template:GenericBox/doc and add it to the GenericBox template in a green box.

Best practice

The code should be added at the bottom of the template code, with no space before "<noinclude>" (which would cause extra space on pages where the template is used).

Categories and interwiki links that apply to the template itself should be added to the bottom of the /doc subpage, inside <includeonly></includeonly> tags. For more complex cases, see Wikipedia:Template documentation#Categories and interwiki links.

If the documentation page contains <includeonly> or <noinclude> tags as part of the visible documentation text, replace the "<" with "&lt;".

Automatic functions

If the documentation page doesn't exist, the [create] link includes a preload page so that clicking it will pre-fill the edit form with the basic documentation page format. Preload text is also used for the /sandbox and /testcases (create) links.

When this template is on a protected template page it now automatically adds {{pp-template}} which shows the grey or red padlock in the top right corner. So no need to manually add {{pp-template}} to templates that use {{documentation}}.

When this template is on a /sandbox subpage it automatically adds the {{template sandbox notice}}.

Advanced Usage

Advanced users may be interested in reading the Wikipedia Article on how to use this template. This template is used heavily on the Wikipedia site and they have extensive examples on how to use this specific template.

See also