Template:Documentation/doc: Difference between revisions

Template page
Content added Content deleted
clockup>Default
No edit summary
 
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{Documentation}}
==Description==
The '''documentation''' template is transcluded in the template/module documentation. This template should only be used on subpages titled "doc".
This template is used to insert descriptions on template pages.

==Syntax==
Add <code><nowiki><noinclude></nowiki>{{t|documentation}}<nowiki></noinclude></nowiki></code> at the end of the template page.


==Usage==
==Usage==
Place {{t|documentation}} at the top of the documentation page.


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}}.
===On the Template page===
This is the normal format when used:

<pre>
TEMPLATE CODE<includeonly>Any categories to be inserted into articles by the template</includeonly><noinclude>
{{documentation}}</noinclude>
</pre>

''If your template is not a completed div or table, you may need to close the tags just before <code><nowiki>{{documentation}}</nowiki></code> is inserted (within the noinclude tags).''

''A line break right before <code><nowiki>{{documentation}}</nowiki></code> can also be useful as it helps prevent the documentation template "running into" previous code.''

===On the Template/doc page===
Normally, you will want to write something like the following on the documentation page:

<pre>
==Description==
This template is used to do something.

==Syntax==
Type <code>{{t|templatename}}</code> somewhere.

==Samples==
<code>&lt;nowiki>{{templatename|input}}&lt;/nowiki></code>

results in...

{{templatename|input}}

<includeonly>Any categories for the template itself</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
</pre>


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}}
Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or other sections.


==Note==
Note that the above example also uses the [[Template:T]] and [[Template:T/piece]] templates.
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>


==TemplateData==
<includeonly>[[Category:Templates|{{PAGENAME}}]]</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
<templatedata>
{
"params": {},
"description": "The documentation template is transcluded in the template/module documentation. This template should only be used on subpages titled \"doc\"."
}
</templatedata>

Latest revision as of 07:22, 9 June 2023

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.