Template:Documentation page/doc: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[checked revision][checked revision]
Content added Content deleted
(add notes on how to write documentation page)
m (add documentation for documentation templates)
 
Line 8: Line 8:
-->Your text goes here.<!--
-->Your text goes here.<!--
-->{{#if:{{{nocat|}}}||[[Category:Some cool category]]}}
-->{{#if:{{{nocat|}}}||[[Category:Some cool category]]}}
</syntaxhighlight>

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:
<syntaxhighlight lang="mediawiki">
<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>
</syntaxhighlight><!--
</syntaxhighlight><!--
-->{{#if:{{{nocat|}}}||[[Category:Meta-templates]]}}
-->{{#if:{{{nocat|}}}||[[Category:Meta-templates]]}}

Latest revision as of 17:17, 19 June 2024

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>