Template:Doc

From Shmups Wiki -- The Digital Library of Shooting Games
Revision as of 17:29, 6 December 2020 by Komidore64 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search



Document how a template works and how to use it.

Usage

Create a subpage of the template called doc, place a {{doc/start}} at the start of your documentation, and {{doc/end}} at the end.

On the main template page add <noinclude>{{clear}}{{doc}}</noinclude> on a newline at the end of the template.

Documentation subpages will automatically be added to Category:Documentation templates.

Optional parameters

clear

If your main template page has floating content and you would like to stop it from going over the documentation, put {{doc/start|clear}} instead of {{doc/start}} on your documentation page.

This is also useful for templates not using <includeonly> tags, as it will put some space between the template and the documentation box.

nodoc=1

If a template has no documentation and you don't know how to use it, put {{doc/start|nodoc=1}} (or if the template needs clear as well, {{doc/start|clear|nodoc=1}}) instead of {{doc/start}} on your documentation page.

The documentation's background will become red to make it more noticeable, and the page will be added to Category:Templates with no documentation.

baddoc=1

Similar to nodoc, baddoc is used to mark templates that do have documentation, but it isn't very good. This can mean it doesn't have enough examples, doesn't explain all the functions properly, or doesn't explain the point of the template well.

The documentation's background will become yellow to make it more noticeable, and the page will be added to Category:Templates with bad documentation.

If both nodoc and baddoc are specified, baddoc will be ignored.

Example

Let's say we want to add a template named HelloWorld. Its contents are the following:

Hello, {{{1}}}!

To document how this template works for other editors, we create a subpage of it called doc, having the full article name of HelloWorld/doc.

Within that subpage we'll put the following wikitext:

{{doc/start}}

Say hello!

== Usage ==

Say hello to a name.

{{HelloWorld|NAME}}

== Example ==

{{HelloWorld|James}}

gives:

Hello, James!
{{doc/end}}

Now that we've documented our HelloWorld template, we need to reference our documentation from the template by adding it at the bottom.

Hello, {{{1}}}!
<noinclude>{{clear}}{{doc}}</noinclude>

Now the template's documentation will be displayed any time the template is viewed!