Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Documentation/doc: Difference between revisions

Template page
Arin Mara (talk | contribs)
mNo edit summary
m Update doc.
Line 1: Line 1:
;Description
{{Tocright}}; Description
:This template is used to insert documentation on template pages.
: This template is used to insert documentation on template pages.
;Syntax and Parameters
:Type <code><nowiki><noinclude>{{t|documentation|<var>{{FULLPAGENAME}}/doc</var>}}</noinclude></nowiki></code> at the end of the template page. Include the full (exact, including namespace) name of the documentation page as a parameter where posible.


==General usage==
; Dependencies
===On the Template page===
:; Uses
You should attach <code><nowiki><noinclude>{{t|documentation|{{subst:FULLPAGENAME}}/doc}}</noinclude></nowiki></code> to the end of the template page, so it looks like the below:
:: {{T|Documentation/preload}} when no actual documentation is added yet.
 
; Syntax
: Type <code><nowiki><noinclude>{{Documentation</noinclude></nowiki></code> at the end of the template page.
 
== General usage ==
=== On the Template page ===
You should attach <code><nowiki><noinclude>{{T|Documentation}}</noinclude></nowiki></code> to the end of the template page, so it looks like the below:
<pre>
<pre>
<includeonly> TEMPLATE CODE HERE
TEMPLATE CODE HERE
Any categories to be inserted into articles by the template</includeonly><noinclude>
Template code
{{documentation|{{subst:FULLPAGENAME}}/doc}}</noinclude>
<includeonly> Any categories to be inserted into articles by the template</includeonly><noinclude>
{{documentation}}</noinclude>
</pre>
</pre>


This will fill in add the documentation template to the template-page, ''but not pages where the template is used'' due to the inclusion tags. The subst:FULLPAGENAME serves as a wikimedia "Magic Word" and will be replaced by the wikispace and page name once the edit is completed, and serves to direct the template towards the appropriate page for substitution in case the automatic code fails to work.
This will add the documentation template to the template-page, ''but not to pages where the template is used'' due to the inclusion tags.
 
=== On the Template/doc page ===
You should fill this out with information on how to use the template. Unused items should be removed.


===On the Template/doc page===
You should fill this out with information on how to use the template. For example,
:''See also [[Template:Documentation/preload]]''
:''See also [[Template:Documentation/preload]]''
<pre>
<pre>
;Description
; Description
:This template is used to do something.
: A short description of the purpose of the template.
;Syntax
:Type <code>{{t|templatename}}</code> somewhere.
;Sample output
:<code>&lt;nowiki>{{templatename|foo}}</nowiki></code> gives...
:{{templatename|foo}}


<includeonly>Any categories for the template itself</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
; Dependencies
</pre> <!-- why should the tags be the same as the main template page? - Telinchei, 2015 -->
:; Uses
:: Resource used by this template (Use linking or {{T}} where possible)
:: Resource used by this template
:: Repeat as needed ...
:; Used by
:: Template that uses this template (Preferably by using {{T|Templatename}} ))
:: Repeat as needed ...
 
; Syntax
: {{T|Templatename|param|...}}
 
; Parameters
:; param
;; Param description
:; param
;; Param description
OR
:; param : Param description
:; param : Param description
 
Repeat as needed ...
 
; Sample
: <code>&lt;nowiki>{{templatename}}</nowiki></code> gives...
: {{templatename}}
 
<includeonly>[[Category:Any categories for the template itself]]</includeonly><noinclude>
[[Category:Template documentation]]</noinclude>
</pre>


Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or further usage information sections.
Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or further usage information sections.


Note that the above example also uses {{t|T}} to display the formatting of the template code, without actually calling the template for transclusion (as normally happens with the squiggly brackets).
Note that the above example also uses {{T|T}} to display the formatting of the template code, without actually calling the template for transclusion (as normally happens with the squiggly brackets).


==Rationale==
== Rationale ==
This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.  According to [http://www.mediawiki.org/wiki/Template:Documentation/doc#Rationale MediaWiki] it also helps reduce server resource demand by circumventing certain technical limitations of templates.  Unfortunately they don't say what those limitations are, exactly. - 2012, [[User:Quinn fellthorn]]
This template allows any page to use any documentation page, and makes it possible to protect templates while allowing anyone to edit the template's documentation, categories, and interwiki links.  According to [http://www.mediawiki.org/wiki/Template:Documentation/doc#Rationale MediaWiki] it also helps reduce server resource demand by circumventing certain technical limitations of templates.  Unfortunately they don't say what those limitations are, exactly. - 2012, [[User:Quinn fellthorn]]
: [[User:Telinchei]] would suggest to the those relate to server resources, when deciding what to transclude (finding noinclude tags) from the template page.
: [[User:Telinchei]] would suggest to the those relate to server resources, when deciding what to transclude (finding noinclude tags) from the template page.
Line 45: Line 75:
</includeonly>
</includeonly>
<noinclude>
<noinclude>
[[Category:Template documentation|{{PAGENAME}}]]
[[Category:Template documentation]]
</noinclude>
</noinclude>