Template:Documentation/doc

From Wikisource
Jump to navigation Jump to search
{{template documentation}}

This template automatically displays a documentation box with content transcluded from another page. It is intended for pages which are transcluded in other pages (ie templates), whether or not they are in the template namespace.

Usage[edit]

<noinclude>{{documentation}}<noinclude>
or <noinclude>{{documentation|template:any page/doc}}<noinclude>

This code should be added at the bottom of the template code, with no extra space before "<noinclude>" (which would cause extra space on pages where the template is used). The parameter can be used as shown above to transclude an arbitrary documentation page.

Add categories to the documentation page inside includeonly tags.

If the documentation page contains includeonly or noinclude tags as part of the documentation, replace the "<" with "&lt;".

The content can also be fed directly as text. Like this:

<!--Last line of your template code--><noinclude>
{{Documentation |content=
Some documentation text.
}}

<!-- Categories go on the /doc subpage, and interwikis go on Wikidata. -->
</noinclude>

When the |content= parameter is used, the doc box normally does not show the [edit] [purge] links in the top right corner. Note that if the /doc page exists a link to it is still shown in the link box below the doc box.

Functions[edit]

If the documentation page doesn't exist, the "edit" link includes a preload parameter so that clicking it will pre-fill the edit form with the basic documentation page format.

Rationale[edit]

This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation and categories.

See also[edit]