Template:Documentation: Difference between revisions

From FasciPedia
Jump to navigation Jump to search
en>Celdrรธn
(French was missing.)
ย 
m (1 revision imported)
ย 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<onlyinclude><includeonly><!--
<div class="template-documentation"><!--
-
- Article Header
-
-->{{#ifeq: {{SITENAME}}|Templates Wiki||<!--
--><div style="margin:1em; padding:10px; border: 0.5px solid #c91010; border-radius:10px; background:#f001"><span class="error">'''Your wiki got a version of [[Template:Documentation]] that is only relevant to [[w:c:templates|Templates Wiki]]!''' [{{fullurl:Template:Documentation}}?action=history Click here to revert it.]</span>
For a documentation template you can use on your wiki, see [[w:c:templates:Template:Documentation (copy)|Template:Documentation (copy) on Templates Wiki]].</div>}}<!--


--><div style="text-align:center;"><span style="font-size:large;">Template information, documentation, and installation instructions.</span><br/>
These are the literal class definitions in common.css:
Expand the below text for usage and other information.</div>
----<!--
/* For template documentation */
-
.template-documentation {
- Documentation Transclusion
ย  ย  clear: both;
-
ย  ย  margin: 1em 0 0 0;
-->{{#if: {{{installonly|}}} |<!-- Hide doc page, useful for documentation templates -->|<div style="padding:10px; border:1px solid #444c4d; clear:both; margin-bottom:0; border-bottom:unset; border-radius:10px 10px 0 0;" class="mw-collapsible article-table" data-collapsetext="Hide documentation" data-expandtext="Show documentation"><!--
ย  ย  border: 1px solid #aaa;
- Documentation Header
ย  ย  background-color: #ecfcf4;
-->
ย  ย  padding: 5px;
<span style="font-size:large;">'''Template Documentation'''</span><!--
}
<!--
ย 
-->:<div style="margin:0; padding:1em; border: 0.5px solid #444c4d; border-radius:10px;" class="mw-collapsible-content"><!--
ย 
-->''Note: The template above might be broken without the parameters; this is normal.''<br/><!--
-->{{#ifeq:{{{heading|ฮผ}}}|<!--**DEFINED BUT EMPTY**-->
- Documentation Tools
ย  |<!--**NOTHING**-->
-->{{#if: {{{content|}}}
ย  |<div style="padding-bottom:3px; border-bottom: 1px solid #aaa; margin-bottom:1ex">{{#ifeq:{{{content|ฮผ}}}|ฮผ
ย  | [{{fullurl: {{FULLPAGENAME}}|action=edit}} Edit this template] for the documentation<!--
ย  |<span class="editsection plainlinks" id="doc_editlinks">{{#ifexist: {{{1|{{Documentation/docname}}}}}
ย  -
ย  ย  |<!--**ย  ย  /doc EXISTS**ย  -->[[{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} edit]]
-->| {{#ifexist: {{{1|{{FULLPAGENAME}}/doc}}}
ย  ย  |<!--**/doc DOESN'T EXIST**-->[[{{fullurl:{{{1|{{Documentation/docname }}}}}|action=edit&preload=Template:Documentation/preload}} create]]
ย ย  ย  | View, edit, or check the history of [[:{{{1|{{FULLPAGENAME}}/doc}}}|this documentation]].
ย  }}</span>
ย  ย  |[{{fullurl: {{{1|{{FULLPAGENAME}}/doc}}}
ย  }} <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>
ย  ย  ย  ย  ย  ย  ย  |action=edit&preload=Template:Documentation/preload<!--
}}<!--
ย  ย  ย  ย  ย  ย  -->&summary={{urlencode:Create documentation for [[{{FULLPAGENAME}}]]}}
ย 
ย  ย  ย  ย  ย  ย  ย  }} Create documentation] for this template.
--><div id="template_doc_page_transcluded" class="dablink plainlinks"><!--
ย  ย  }}
ย  -->{{#ifexist: {{{1|{{Documentation/docname}}}}}
ย  ย  }} ([[Template:Documentation/doc|How does this work?]])<br/>Editors can experiment with this template's [{{fullurl:{{{sandbox|{{FULLPAGENAME}}/sandbox}}}
ย  |<!--**/doc EXISTS**-->This documentation is transcluded from [[{{{1|{{Documentation/docname}}}}}]]. <small style="font-style: normal">([{{fullurl:{{{1|{{Documentation/docname}}}}}|action=edit}} edit] &#124; [{{fullurl:{{{1|{{Documentation/docname}}}}}|action=history}} history])</small><br />
ย  | action=edit&redlink=1&preload=Template:Documentation/preload-sandbox<!--
}}<!--
ย  -->&summary={{urlencode:Create sandbox version of [[{{FULLPAGENAME}}]]}}
ย 
ย  }} sandbox] and [{{fullurl:{{{testcases|{{FULLPAGENAME}}/testcases}}}
-->{{#switch: {{SUBPAGENAME}}
ย  | action=edit&redlink=1&preload=Template:Documentation/preload-testcases<!--
ย  |sandbox|testcases=<!--**DO NOT SHOW THESE LINKS ON THE SANDBOX/TESTCASES PAGES**-->
ย  -->&summary={{urlencode:Create testcases subpage of [[{{FULLPAGENAME}}]]}}
ย  |#default=
ย  }} testcases].
ย  ย  {{#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>
--><div style="background:none;" class="mw-collapsible-content">
{{Tocright}}
{{#if:{{{content|}}}
ย  | {{{content}}}{{clear}}
ย 
ย  | {{#ifexist: {{{1|{{FULLPAGENAME}}/doc}}}
ย  ย  | {{#if: {{{1|}}}
ย  ย  ย  |{{{{{1}}}}}
ย  ย  ย  |{{<!---->{{FULLPAGENAME}}/doc}}}}{{clear}}
ย  ย  | Documentation does not exist. Create it at [{{fullurl:
ย  ย  ย  ย  ย  ย  ย  {{#if:{{{1|}}}|{{{1}}}|{{FULLPAGENAME}}/doc}}
ย  ย  ย  ย  ย  ย  ย  |action=edit&preload=Template:Documentation/preload<!--
ย  ย  ย  ย  ย  ย  -->&summary={{urlencode:Create documentation for [[{{FULLPAGENAME}}]]}}<!--
ย  ย  ย  ย  ย  ย  --> {{#if:{{{1|}}}|{{{1}}}|{{FULLPAGENAME}}/doc}}] [[category:templates without documentation]].
ย  }}<!--end if 1-->
}}
<!--end if content-->
}}
</div></div><div style="display:none;">
----
</div><!--
- Installation
-
-->}}<div style="padding:10px;border:1px solid #444c4d; margin-top:0; border-radius:0 0 10px 10px;" class="mw-collapsible article-table" data-collapsetext="Hide install instructions" data-expandtext="Show install instructions">
<span style="font-size:large;">'''Installation Instructions'''</span><!--
--><div class="mw-collapsible-content">
<!--
-
- The section for the exporting the template.
-
--><div style="margin:1em; padding:5px; background:#0121; border: 0.5px solid #36475e; border-radius:10px;clear: both;">
ย  {{#ifeq:{{{SPW}}}|is not relevant
ย  ย  |
ย  ย  <!--
ย  ย  - Export links
ย  ย  -->
ย  ย  | :'''''[{{fullurl:Special:Export}}?link1=Template:{{PAGENAMEE}}&link2=Template:{{PAGENAMEE}}/doc<!--
ย  ย  -->{{#if:{{{dep1|}}}|&link3={{{dep1}}}&link4={{{dep1}}}/doc}}<!--
ย  ย  -->{{#if:{{{dep2|}}}|&link5={{{dep2}}}&link6={{{dep2}}}/doc}}<!--
ย  ย  -->{{#if:{{{dep3|}}}|&link7={{{dep3}}}&link8={{{dep3}}}/doc}}<!--
ย  ย  -->{{#if:{{{dep4|}}}|&link9={{{dep4}}}&link10={{{dep4}}}/doc}}<!--
ย  ย  - Alt text
ย  ย  --><!--
ย  ย  -
ย  ย  - Main Text
ย  ย  -
ย  ย  --> Export this template]''', then [[w:Help:Importing and exporting pages|import]] to install it.<br/><!--
ย  ย  -->''Use edit summary: ''<code><nowiki>Copied from [[w:c:templates:</nowiki>{{FULLPAGENAME}}<nowiki>]]</nowiki></code>'' to properly attribute this template's editors.}}<!--
ย  ย  - If compatible with vanilla MediaWiki
ย  ย  -->{{#if:{{{vanilla|}}}|:''This template is compatible with vanilla MediaWiki.''}}
ย  ย  <!--
ย  ย  -
ย  ย  - is not relevant = Should be '''NOT''' copied
ย  ย  -
ย  ย  -->
:{{#switch: {{{SPW|}}}
ย  ย  | starter = This template is created by default after March 11, 2020. It should be in your wiki. [[Category:Starter templates]]
| is not relevant
| is not relevant to = [[File:Warning.svg|left|50px]]<!--
ย  ย  -->''This template should not be copied, because it is probably not relevant to wikis other than Templates Wiki. '''You probably don't want to copy this template to your wiki.''' {{#if:{{{SPW-link|}}}|For a similar template intended to be copied, see [[Template:{{{SPW-link}}}]].''}}<!--
ย  -->{{#ifeq: {{SITENAME}}
ย  ย  ย  ย  | Templates Wiki
ย  ย  ย  ย  | [[Category:Templates Wiki templates]]
ย  ย  ย  }}
ย  }}
</div><!-- End Section -->
<!--
-
- Interlanguage links
-
--><!--
- French
-->{{#if:{{{fr|}}}
ย  ย  |[[fr:{{{fr}}}]]
ย  ย  |
ย  }}<!--
- Japanese
-->{{#if:{{{ja|}}}
ย  ย  |[[ja:{{{ja}}}]]
ย  ย  |
ย  }}<!--
- Turkish
-->{{#if:{{{tr|}}}
ย  ย  |[[tr:{{{tr}}}]]
ย  ย  |
ย  }}<!--
- Simplified Chinese
-->{{#if:{{{zh|}}}
ย  ย  |[[zh:{{{zh}}}]]
ย  ย  |
ย  ย  }}
<!--
-
- Installation Instructions
-
-->
{{#ifeq: {{{SPW}}}|is not relevant |
|{{#if: {{PROTECTIONEXPIRY: edit |{{{install|{{FULLPAGENAME}}/install}}}}}
ย  | ''The above message will be enough for most cases; if there are additional instructions, you can see them below.''<br/><!--
ย  --> {{<!---->{{{install|{{FULLPAGENAME}}/install}}}}}
ย  | :There is no additional installation instructions for this template. If there is any, you may create it at [{{fullurl:
ย  ย  ย  ย  ย  ย  ย  {{{install|{{FULLPAGENAME}}/install}}}
ย  ย  ย  ย  ย  ย  ย  |action=edit&preload=Template:Documentation/preload-install<!--
-->}} {{{install|{{FULLPAGENAME}}/install}}}].
}}
}}
</div></div></includeonly></onlyinclude>
{{Documentation|SPW = is not relevant|SPW-link = Documentation (copy)|fr=Modรจle:Documentation|ja=Template:Documentation|tr=ลžablon:Belgelendirme|zh=Template:Documentation|content= This is a version of Template:Documentation customized for Templates Wiki and so not designed to be copied to other wikis.
ย 
It acts identically to the usual Template:Documentation - and should be treated identically - except for a few particular cases.
* <code>content = </code> should the template have just a short blurb for documentation and not need a new page for it.
* <code>installonly =</code> for documentation templates
* If the template '''should transclude a documentation page other than its /doc subpage,''' use <code><nowiki>{{Documentation|documentation page}}</nowiki></code>.
*: You may also use <code><nowiki>{{Documentation|content=documentation goes here}}</nowiki></code> to include documentation without a subpage at all.
* If the template '''should be [[w:Help:Interlanguage links|interlanguage linked]] but at a different name,''' use <code><nowiki>{{Documentation|fr=French name|ja=Japanese name|tr=Turkish name|zh=Chinese name}}</nowiki></code>.
*: You might instead create a [[w:Help:Redirect|redirect]] on the foreign-language wiki from the name used on this wiki to theirs.
* SPW
** <code>SPW=is not relevant</code> - The template (such as this one) are not relevant to wikis other than Templates Wiki.
** <code>SPW=starter</code> - The wikis after created on March 11, 2020 by default.
* <code>dep1=</code><code>dep2=</code><code>dep3=</code><code>dep4=</code> to name up to four dependency templates (include Template: prefix, no need to name /doc pages).
}}[[Category:Documentation templates| ]]

Latest revision as of 21:26, 12 July 2024

[[{{fullurl:Template:Documentation/docname|action=edit&preload=Template:Documentation/preload}} create]] Template documentation

[edit] [purge] Documentation

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>{{Documentation}}</noinclude> at the end of the template page.

Add <noinclude>{{Documentation|<documentation page>}}</noinclude> to transclude an alternative page from the /doc subpage.

To add documentation inline, meaning on the main template page itself, add <noinclude>{{Documentation|content=custom inline content}}</noinclude>

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.

Template parameters

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Custom page to transclude1

A custom page to transclude, usually another documentation page

Page nameoptional
Custom contentcontent

Custom inline content to add in the template. When this is added, the template does not transclude 1= or the /doc subpage

Stringoptional
Demo pagepage

For testing purposes

Page nameoptional
Demo namespacedemospace

For testing purposes; changes the internal namespace of the template

Stringoptional
Custom documentation preloadpreload

Custom documentation preload that will be used for the [create] links for the /doc subpage

Page nameoptional
Custom preload page for /sandbox subpagepreload-sandbox

no description

Page nameoptional
Custom preload page for /testcases subpagepreload-testcases

no description

Page nameoptional
Custom /sandbox subpagesandbox

Page that is used for the /sandbox link

Page nameoptional
Custom /testcases pagetestcases

Page that is used for the /testcases link

Page nameoptional
Custom heading textheading

no description

Stringoptional
Disable footernofooter

Disables the footer or "link box" located below the documentation content.

Booleanoptional

Dependencies

Templates
Template:Documentation/preload
Template:Documentation/preload-sandbox
Template:Documentation/preload-testcases
Images
File:Documentation_icon.svg
File:No_Documentation_icon.svg