Difference between revisions of "Template:Documentation/doc"

From EVE University Wiki
Jump to: navigation, search
(Don't need the SPW template in all template documentation)
(Added explanation for why the new documentation mechanism should be preferred to inline template documentation.)
Line 36: Line 36:
 
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}}.<includeonly>
+
Note that the above example also uses {{t|T}}.
 +
 
 +
==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.
 +
<includeonly>
 
[[Category:General wiki templates|{{PAGENAME}}]]
 
[[Category:General wiki templates|{{PAGENAME}}]]
</includeonly><noinclude>
+
</includeonly>
 +
<noinclude>
 
[[Category:Template documentation|{{PAGENAME}}]]
 
[[Category:Template documentation|{{PAGENAME}}]]
 
</noinclude>
 
</noinclude>

Revision as of 20:05, 5 January 2012

Description
This template is used to insert documentation on template pages.
Syntax
Type <noinclude>{{documentation}}</noinclude> at the end of the template page.

General usage

On the Template page

Template code<includeonly>Any categories to be inserted into articles by the template</includeonly><noinclude>
{{documentation}}</noinclude>

On the Template/doc page

See also Template:Documentation/preload
;Description
:This template is used to do something.
;Syntax
:Type <code>{{t|templatename}}</code> somewhere.
;Sample output
:<code><nowiki>{{templatename|foo}}</nowiki></code> gives...
:{{templatename|foo}}

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

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}}.

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 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.