Template:Documentation: Difference between revisions
en>Celdrรธn (French was missing.) ย |
m (1 revision imported) ย |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<div class="template-documentation"><!-- | |||
- | These are the literal class definitions in common.css: | ||
- | /* For template documentation */ | ||
.template-documentation { | |||
ย ย clear: both; | |||
ย ย margin: 1em 0 0 0; | |||
-->{{# | ย ย border: 1px solid #aaa; | ||
- Documentation | ย ย background-color: #ecfcf4; | ||
--> | ย ย padding: 5px; | ||
<span style="font-size: | } | ||
<!-- | ย | ||
--> | ย | ||
--> | -->{{#ifeq:{{{heading|ฮผ}}}|<!--**DEFINED BUT EMPTY**--> | ||
- Documentation | ย |<!--**NOTHING**--> | ||
ย |<div style="padding-bottom:3px; border-bottom: 1px solid #aaa; margin-bottom:1ex">{{#ifeq:{{{content|ฮผ}}}|ฮผ | |||
ย |<span class="editsection plainlinks" id="doc_editlinks">{{#ifexist: {{{1|{{Documentation/docname}}}}} | |||
ย ย |<!--**ย ย /doc EXISTS**ย -->[[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} edit]] | |||
-->| {{# | ย ย |<!--**/doc DOESN'T EXIST**-->[[{{fullurl:{{{1|{{Documentation/docname }}}}}|action=edit&preload=Template:Documentation/preload}} create]] | ||
ย ย ย | | ย }}</span> | ||
ย }} <span style="{{#if:{{{heading-style|}}}|{{{heading-style}}}|{{#ifeq:{{NAMESPACE}}|{{ns:template}}|font-weight: bold; font-size: 125%|font-size: 150%}}}}">{{#if:{{{heading|}}}|{{{heading}}}|{{#ifeq:{{NAMESPACE}}|{{ns:template}}| Template documentation|Documentation}}}}</span></div> | |||
}}<!-- | |||
ย | |||
--><div id="template_doc_page_transcluded" class="dablink plainlinks"><!-- | |||
ย -->{{#ifexist: {{{1|{{Documentation/docname}}}}} | |||
ย |<!--**/doc EXISTS**-->This documentation is transcluded from [[{{{1|{{Documentation/docname}}}}}]]. <small style="font-style: normal">([{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} edit] | [{{fullurl:{{{1|{{Documentation/docname}}}}}|action=history}} history])</small><br /> | |||
}}<!-- | |||
ย | |||
-->{{#switch: {{SUBPAGENAME}} | |||
ย |sandbox|testcases=<!--**DO NOT SHOW THESE LINKS ON THE SANDBOX/TESTCASES PAGES**--> | |||
ย |#default= | |||
ย ย {{#switch: {{SUBJECTSPACE}} | |||
ย ย |{{ns:template}} | |||
ย ย ย |{{ns:user}}= | |||
ย ย ย {{#ifexist: {{FULLPAGENAME}}/sandbox | |||
ย ย ย |This template has a [[/sandbox|sandbox]] <small style="font-style: normal">([{{fullurl:{{ #rel2abs: /sandbox }}|action=edit}} edit])</small> <!-- | |||
ย ย ย ย -->{{#ifexist: {{FULLPAGENAME}}/testcases | |||
ย ย ย ย |and [[/testcases|testcases]] <small style="font-style: normal">([{{fullurl:{{ #rel2abs: /testcases }}|action=edit}} edit])</small>}} for editors to experiment. | |||
ย ย ย |{{#ifexist: {{FULLPAGENAME}}/testcases | |||
ย ย ย ย |This template has [[/testcases|testcases]] <small style="font-style: normal">([{{fullurl:{{ #rel2abs: /testcases }}|action=edit}} edit])</small> for editors to experiment.}} | |||
}}}}}} | |||
</div> | |||
{{#if:{{{content|}}}|{{{content}}}|{{#ifexist:{{{1|{{Documentation/docname}}}}} | {{ {{{1|{{Documentation/docname}}}}} }} }}}} | |||
</div> | </div> | ||
< | <noinclude> | ||
{{Doc}}</noinclude> | |||
}} | |||
</ | |||
ย | |||
Latest revision as of 21:26, 12 July 2024
description
- Note: This template requires the variables extension. See Help:Extensions on Community Central for information on how to request this.
This template is used to insert template information, its parameters, and other information on a template page. More information may be found at Help:Template documentation on Community Central.
Syntax
Add <noinclude> at the end of the template page.
{{Documentation}}</noinclude>
Add <noinclude> to transclude an alternative page from the /doc subpage.
{{Documentation|</noinclude><documentation page>}}
To add documentation inline, meaning on the main template page itself, add <noinclude>
{{Documentation|</noinclude>content=custom inline content}}
For full syntax, see #Advanced syntax.
Basic usage
On the Template page
This is the normal format when used:
TEMPLATE CODE
<includeonly>Any categories to be inserted into articles by the template</includeonly>
<noinclude>{{Doc}}</noinclude>
Some notes:
- If your template is not a completed div or table, you may need to close the tags just before
{{Doc}}is inserted (within the noinclude tags). - A line break right before
{{Doc}}can also be useful as it helps prevent the documentation template "running into" previous code. - If for some reason you need to transclude a different page other than the documentation page (e.g. when using a group of templates with same documentation), you can use the
|1=parameter (see Syntax). - If the template documentation is rather short, you can specify documentation inline with the text, by using the
|content=parameter (see Syntax again).
On the documentation page
The documentation page is usually located on the /doc subpage for a template, but a different page can be specified with the first parameter of the template (see Syntax).
Normally, you will want to write something like the following on the documentation page:
== Description ==
This template is used to do something.
== Syntax ==
Type <code>{{t|templatename|param1}}</code> somewhere.
=== Parameters ===
;<code>param1</code>
: This parameter is used to add something.
=== TemplateData ===
<templatedata>{}</templatedata>
== Examples ==
<code><nowiki>{{templatename|input}}</nowiki></code>
results in...
{{templatename|input}}
<includeonly>Any categories for the template itself</includeonly>
<noinclude>[[Category:Template documentation]]</noinclude>
Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or other sections.
Advanced syntax
This template is used to insert a description of a template.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Custom page to transclude | 1 | A custom page to transclude, usually another documentation page | Page name | optional |
| Custom content | content | Custom inline content to add in the template. When this is added, the template does not transclude 1= or the /doc subpage | String | optional |
| Demo page | page | For testing purposes | Page name | optional |
| Demo namespace | demospace | For testing purposes; changes the internal namespace of the template | String | optional |
| Custom documentation preload | preload | Custom documentation preload that will be used for the [create] links for the /doc subpage | Page name | optional |
| Custom preload page for /sandbox subpage | preload-sandbox | no description | Page name | optional |
| Custom preload page for /testcases subpage | preload-testcases | no description | Page name | optional |
| Custom /sandbox subpage | sandbox | Page that is used for the /sandbox link | Page name | optional |
| Custom /testcases page | testcases | Page that is used for the /testcases link | Page name | optional |
| Custom heading text | heading | no description | String | optional |
| Disable footer | nofooter | Disables the footer or "link box" located below the documentation content. | Boolean | optional |