Template:Documentation

From OSDev.wiki
Jump to navigation Jump to search

Template documentation

Transcluded from Template:Documentation/doc

This template is meant to be included in a <noinclude> block at the end of a template with documentation located in the /doc subpage. This subpage is then transcluded inside a green box in the template page, as with this very text, when read from the main template page. One can use different content by setting the content argument. If there are positional arguments present, these will be used to form a list in the transcluded from notice, rather than the default /doc subpage. For example:

{{Documentation|Template:Documentation page/doc|Template:Redirect page/doc|content=
== Documentation page documentation ==
{{Documentation page/doc}}
== Redirect page documentation ==
{{Redirect page/doc}}
}}

Will produce:

Template documentation

Transcluded from Template:Documentation page/doc and Template:Redirect page/doc

Documentation page documentation

This template is meant to be included in a <noinclude> block at the start of template documentation pages, such as this one. It produces a message box and adds the documentation page to Category:Template documentation (this can be disabled by setiing the template argument nocat). There is also the meta parameter for documentation pages meant as templates for other documentation pages. Setting this parameter produces following:

This is a template documentation page

This is a template for the documentation of templates based on Template:Documentation.

When writing a template documentation page make sure to not having leading or trailing empty lines when transcluding, otherwise a larger paragraph gap than usual will be produced when transcluding through {{Documentation}}. Template categories should be added to the documentation page and be transcluded by the main template page. Keep in mind to add a nocat option to template documentation pages:

<noinclude>{{Documentation page}}</noinclude><!--
-->Your text goes here.<!--
-->{{#if:{{{nocat|}}}||[[Category:Some cool category]]}}

Often templates based on a meta-template will large parts of the documentation, or even the entire documentation, in common. Thus, one can move the common part to a subpage (typically "/doc template", in order to distinguish it from the documentation of the meta-template itself). That subpage could be structured as follows:

<noinclude>{{Documentation page|meta=1}}</noinclude><!--
-->Your text goes here. Here is a template argument: {{{1}}}.<!--
--><includeonly>{{#if:{{{nocat|}}}||[[Category:Category for derived templates]]}}</includeonly><noinclude>[[Category:Meta-templates]]</noinclude>

Redirect page documentation

This template serves as a base for all redirect pages. Without any arguments, it produces the message box on the top of the page, and the redirect in question is automatically categorized in Category:Uncategorized redirects (which can be disabled by setting the nocat parameter). This template takes a single positional argument, which should be a list of redirect templates, that each add a category to the redirect. For example:

{{Redirect page|
{{R to project page}}
}}

Will produce:

This page is a redirect.

This redirect is categorized in following manner: