Template:Documentation/doc: Difference between revisions

Template page
 
Line 1: Line 1:
This template automatically displays a documentation box like you are seeing now, of which the content is transcluded from another page (usually PAGENAME/doc). It is intended for pages which are transcluded in other pages, i.e. templates, whether in the template namespace or not.
The '''documentation''' template is transcluded in the template/module documentation. This template should only be used on subpages titled "doc".
 
Use this template only if the template page you're using it on has a documentation at ''Template:TEMPLATENAME/doc''. If not, create this page before you proceed.


== Usage ==
== Usage ==
<pre>
Place {{T|Documentation}} at the top of the documentation page.
<noinclude>{{Documentation}}</noinclude>
</pre>
 
This code should be added at the bottom of the template code, with no extra space before "<code>&lt;noinclude></code>" (which would cause extra space on pages where the template is used).
 
The template usually transcludes content from PAGENAME/doc. If you want to transclude content from a different page, specify its pagetitle behind a <code>|</code>, like this:


<pre>
If the page to be documented is a subpage, use {{T|Documentation|pagename of page to be documented}} at the top of the documentation page. For example, Template:Foo/bar's documentation page would use {{T|Documentation|Template:Foo/bar}}.
<noinclude>{{Documentation|Other page}}</noinclude>
</pre>


The template transcludes now the content from ''Other page''.
The template will attempt to auto detect and link <code><nowiki>{{#Invoke:}}</nowiki></code> calls on template documentations or the <code>require()</code>/<code>mw.loadData()</code> depedency list on module documentations. If you want to supress the auto generated dependency list, use {{T|Documentation|DependencyList=no}}


Categories and interwiki links that apply to the template itself should be added to the documentation page, inside <code>&lt;includeonly> &lt;/includeonly></code> tags.
== Note ==
This template links to a /doc that may appear useless, however, it exists in order to link navboxes and userboxes to their base template's documentation.
<includeonly></includeonly>


If you add a sandbox or testcases at ''Template:TEMPLATENAME/sandbox'' and ''Template:TEMPLATENAME/testcases'', links to these pages will be displayed automatically at the top of the documentation box
== TemplateData ==
<templatedata>
{
"params": {},
"description": "The documentation template is transcluded in the template/module documentation. This template should only be used on subpages titled \"doc\"."
}
</templatedata>


<includeonly>[[Category:Template Documentation| ]]</includeonly><noinclude>[[Category:Template Documentation]]</noinclude>
<includeonly>[[Category:Documentation Templates]]</includeonly><noinclude>[[Category:Template Documentation]]</noinclude>

Revision as of 12:18, 8 April 2022

The documentation template is transcluded in the template/module documentation. This template should only be used on subpages titled "doc".

Usage

Place {{Documentation}} at the top of the documentation page.

If the page to be documented is a subpage, use {{Documentation|<pagename of page to be documented>}} at the top of the documentation page. For example, Template:Foo/bar's documentation page would use {{Documentation|<Template:Foo/bar>}}.

The template will attempt to auto detect and link {{#Invoke:}} calls on template documentations or the require()/mw.loadData() depedency list on module documentations. If you want to supress the auto generated dependency list, use {{Documentation}}

Note

This template links to a /doc that may appear useless, however, it exists in order to link navboxes and userboxes to their base template's documentation.


TemplateData

The documentation template is transcluded in the template/module documentation. This template should only be used on subpages titled "doc".

Template parameters

ParameterDescriptionTypeStatus
No parameters specified
Cookies help us deliver our services. By using our services, you agree to our use of cookies.