Template:Doc

From Nonkiki Wiki
Jump to navigation Jump to search
You are viewing the documentation for Template:Doc, which has been automatically transcluded from its documentation page. You may:
  • edit the template; or:
  • edit the documentation

This template is not designed for transclusion into pages.

This template is specifically designed to be used on other templates.

What it does

Every sufficiently complex template will require documentation. The custom is to place this on a subpage called "doc", eg the documentation for Template:Foo is at Template:Foo/doc.

By clever use of the <noinclude> and <includeonly> tags, the documentation is made to appear when the template page is viewed. This is convenient when trying to find out how a template works, but confusing and inconvenient when trying to edit the template documentation, since the "Edit" lynkke at the top of the page will, of course, edit the template page.

This template will show two edit lynkkes; one for the template page and one for the documentation.

Usage

At the top of every template documentation page, include the line:

<includeonly>{{Doc}}</includeonly>

On the template page for Template:Foo, rather than writing:

content

Instead write:

<includeonly>content</includeonly><noinclude>{{Foo/doc}}</noinclude>