Template:Doc/doc

From Angelina Jordan Wiki
Revision as of 14:53, 12 November 2020 by Dcljr (talk | contribs) (formatting)
This is a subpage documenting Template:Doc. To change the template, edit that page; to change the template's documentation (seen below), edit this one.

Documentation

A call to this template (placed inside of a <noinclude>…</noinclude> element, as seen below) should be the last thing in (almost) every template page. It transcludes the contents of the template's /doc subpage, which contains the template's documentation. (Templates not following this system are listed at Category:Templates not using a documentation subpage.)

After saving a newly created template containing a call to this template, simply follow the "redlink" to create the template's documentation subpage. A bare-bones /doc subpage, suitable for copy-pasting is given below.

Usage

  • active content of template here<noinclude>{{doc}}</noinclude>
  • <includeonly>active content of template here</includeonly><noinclude>{{doc}}</noinclude>

Note that the active content of the template should be immediately followed, on the same line, by the <noinclude> tag. This is to prevent extra vertical whitespace from being introduced into the calling template's output, which can have very strange side-effects in some cases.

Sample /doc subpage contents

You can copy and paste the following wiki markup into any /doc subpage you are creating, as a starting point for your documentation. Obviously, this needs to be fleshed out a bit before you save the page (by replacing each and getting rid of whatever usage lines and example lines are not relevant for your template — the three lines in those sections are for, respectively, bare template calls needing no input, template calls containing unnamed/anonymous/positional parameters as input, and template calls containing named parameters with specified values). See a typical template documentation subpage for how this might look when it's finalized.

<noinclude>{{doc subpage}}[[Category:Template documentation]]</noinclude>
== Documentation ==

…

=== Usage ===

* <code><nowiki>{{…}}</nowiki></code>
* <code><nowiki>{{…</nowiki>|<var>…</var>}}</code>
* <code><nowiki>{{…</nowiki>|…=<var>…</var>}}</code>

=== Examples ===

* <code><nowiki>{{…}}</nowiki></code> → {{…}}
* <code><nowiki>{{…</nowiki>|…}}</code> → {{…|…}}
* <code><nowiki>{{…</nowiki>|…=…}}</code> → {{…|…=…}}

<includeonly>
[[Category:Templates]]
[[Category:…]]
</includeonly>

Note that the categories listed after <includeonly> at the bottom apply to the template that you are documenting (every template should be listed in Category:Templates, and ideally in a few other template-related categories, based on what the template does and how it does it — see the subcategories of Category:Templates to find where your template should be listed). The only category that the /doc subpage itself should have is Category:Template documentation, provided by the first line of this sample code.

See also