Template:Doc subpage

From Angelina Jordan Wiki

Documentation

A call to this template (inside of a <noinclude>…</noinclude> element, as seen below) should be the first thing on every /doc subpage. Such subpages contain documentation of templates, modules, and data.

This template provides a boxed message identifying the calling page (the \doc subpage) as documentation for another page.</noinclude> To see what this looks like, see this template's documentation subpage.

See Template:Doc for more information about creating documentation subpages for templates.

This template is used on a great many pages. Making any changes to it will cause lots of jobs to be added to the processing queue.

Usage

  • <noinclude>{{doc subpage}}</noinclude>

The template automatically adjusts its message according to what namespace it's in. It also places the calling page into Category:Template documentation, Category:Module documentation, or Category:Data documentation, as appropriate.

Sample /doc subpage content

This is for templates specifically, but it can be modified for use on /doc subpages in other namespaces.

You can copy and paste the following wiki markup into any template /doc subpage you are creating, as a starting point for your documentation. Obviously, this needs a little work before you can save the page. To be more specific, you should replace each with whatever content is appropriate, flesh out the usage and examples items (replacing TN with the template name), remove the explanatory <!-- comments -->, and omit anything else that's not relevant for your template). See a typical template documentation subpage for how this might look when it's finalized.

For details on how to use the various "tc" templates, see the documentation of {{tc}}, {{tc-var}}, {{tc-numvar}}, {{tc-namevar}}, and {{tc-names}}.

<noinclude>{{doc subpage}}</noinclude>
== Documentation ==

<!-- replace "…" as appropriate and remove all these HTML comments -->
…<noinclude>[[Category:Incomplete template documentation]]</noinclude>
<!-- remove this category once the documentation is sufficiently detailed -->

=== Usage ===

* {{tc|TN}}<!-- replace TN everywhere by the template name -->
* {{tc|TN|…}}<!-- looks like: {{TN|…}} [with no special formatting] -->
* {{tc-var|TN|…|…}}<!--       {{TN|<var>…</var>|<var>…</var>}}      -->
* {{tc-numvar|TN|…|…}}<!--    {{TN|1=<var>…</var>|2=<var>…</var>}}  -->
* {{tc-namevar|TN|…|…}}<!--   {{TN|…=<var>…</var>|…=<var>…</var>}}  -->
* {{tc-names|TN|…|…}}<!--     {{TN|…=|…=}}                          -->
* {{code|<nowiki>{{TN|…}}</nowiki>}}<!-- for more complex cases  -->

<!-- use whichever forms are needed and delete the rest -->

=== Examples ===

* {{tc|TN}} ⇒ {{TN}}
* {{tc|TN|…}} ⇒ {{TN|…}}
* {{code|<nowiki>{{TN|…}}</nowiki>}} ⇒ {{TN|…}}

<includeonly>
[[Category:Templates]]
[[Category:Templates …]]<!-- see previous category for relevant subcats -->
</includeonly>

The code <noinclude>[[Category:Incomplete template documentation]]</noinclude> found immediately below the == Documentation == header is there merely for convenience, so the documentation can be saved before it is complete enough to be totally useful to readers. This causes the documentation subpage to be listed in Category:Incomplete template documentation, so it can be found later and expanded/improved upon. Once you feel like the amount of documentation you have provided is sufficient, that code can be removed.

Note that the categories listed in the <includeonly>…</includeonly> portion 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, how it does it, and where it should or should not be used (see the subcategories of Category:Templates to determine where your template should be listed). The only category that the /doc subpage itself should have is Category:Template documentation, which is provided automatically by this template (so you don't have to add it yourself).

See also

  • {{doc}} – transcludes a template's documentation onto the template page itself (and thus provides a "redlink" to create the new documentation if it doesn't already exist)