Template:Documentation page/doc: Difference between revisions

m
add documentation for documentation templates
[checked revision][checked revision]
m (move category to documentation)
m (add documentation for documentation templates)
 
(3 intermediate revisions by the same user not shown)
Line 1:
<noinclude>{{Documentation page}}</noinclude><!--
-->This template is meant to be included in a <code><nowiki><noinclude></nowiki></code> 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 <code>nocat</code>). There is also the <code>meta</code> parameter for documentation pages meant as templates for other documentation pages. Setting this parameter produces following:
{{Documentation page|meta=1|nocat=1}}
[[Category:Meta-templates]]
 
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 <code><nowiki>{{Documentation}}</nowiki></code>. Template categories should be added to the documentation page and be transcluded by the main template page. Keep in mind to add a <code>nocat</code> option to template documentation pages:
<syntaxhighlight lang="mediawiki">
<noinclude>{{Documentation page}}</noinclude><!--
-->Your text goes here.<!--
-->{{#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><!--
-->{{#if:{{{nocat|}}}||[[Category:Meta-templates]]}}