Template:Documentation page/doc

From OSDev.wiki
Revision as of 17:17, 19 June 2024 by Lukflug (talk | contribs) (add documentation for documentation templates)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This is a template documentation page

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 page.

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>