Template:Documentation/doc: Difference between revisions

Kwwxis (talk | contribs)
No edit summary
No edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
==Description==
{{Documentation/Header}}
This template is used to insert descriptions on template pages.
{{Lua|Documentation}}
{{CSS}}
This template is used to insert documentation to template pages.


==Syntax==
==Syntax==
Add <code><nowiki><noinclude></nowiki>{{t|Documentation}}<nowiki></noinclude></nowiki></code> at the end of the template page.
* {{T|Documentation}} will produce the documentation template.
* {{T|Documentation|foo}} will fill in the documentation from the "<code>foo</code>" template.
* {{T|Documentation|p1=content=This template does something}} will fill in the documentation with the content "<code>This template does something</code>." (not recommended except for very, very short documentation)
* {{T|Documentation|p1=heading=Important information}} will replace the default heading with "<code>Important information</code>".
* {{T|Documentation|p1=type=category}} will add the "<code>category Templates</code>" category.


Add <code><nowiki><noinclude></nowiki>{{t|Documentation|documentation page}}<nowiki></noinclude></nowiki></code> to transclude an alternative page from the /doc subpage.
==Template Data==
 
<templatedata>
==Usage==
{
 
"description": {
===On the Template page===
"en": "This template is used to insert descriptions on template pages."
This is the normal format when used:
},
 
"format": "inline",
<pre>
"params": {
TEMPLATE CODE
"1": {
<includeonly>Any categories to be inserted into articles by the template</includeonly>
"label": {
<noinclude>{{Documentation}}</noinclude>
"en": "Custom Documentation Page"
</pre>
},
 
"description": {
''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).''
"en": "Page containing the documentation"
 
},
''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.''
"default": "{{FULLPAGENAME}}/doc",
 
"type": "wiki-page-name"
===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|Syntax]]).
"heading": {
 
"label": {
Normally, you will want to write something like the following on the documentation page:
"en": "Heading"
 
},
<pre>
"description": {
==Description==
"en": "Custom heading"
This template is used to do something.
},
 
"default": {
==Syntax==
"en": "[[File:Template-icon.svg|50px|link=|alt=Documentation icon]] Documentation"
Type <code>{{t|templatename}}</code> somewhere.
},
 
"type": "line"
==Samples==
},
<code>&lt;nowiki>{{templatename|input}}&lt;/nowiki></code>
"preload": {
 
"label": {
results in...
"en": "Preload Page"
 
},
{{templatename|input}}
"description": {
 
"en": "The page to preload if the `/doc` subpage doesn't exist."
<includeonly>Any categories for the template itself</includeonly>
},
<noinclude>[[Category:Template documentation]]</noinclude>
"default": "Template:Documentation/preload",
</pre>
"type": "wiki-page-name"
 
},
Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or other sections.
"content": {
 
"label": {
Note that the above example also uses the [[Template:T]] template.
"en": "Content",
"tr": "İçerik"
},
"description": {
"en": "Custom documentation content, prevents transclusion of `/doc` subpage."
},
"type": "content"
},
"type": {
"label": "Type",
"description": "Category to categorize template in.",
"type": "string",
"suggested": true
}
}
}
</templatedata>