Difference between revisions of "Template:Documentation/doc"

From EVE University Wiki
Jump to: navigation, search
(Added explanation for why the new documentation mechanism should be preferred to inline template documentation.)
m (Fix typo.)
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{#ifexist: Template:Documentation/preload | <!-- nothing; preload already copied --> | :<strong class="error">Please copy <nowiki>{{Documentation}}</nowiki>'s preload template from [[w:c:templates:Template:Documentation/preload]] to [[Template:Documentation/preload]]!</strong>}}<!--
+
{{Tocright}}
-->{{#ifexist: Template:T | <!-- nothing; T already copied/exists --> | :<strong class="error">Please copy <nowiki>{{T}}</nowiki> from [[w:c:templates:Template:T]] to [[Template:T]]!</strong>}}<!--
+
; Description
-->{{#ifexist: Template:T/doc | <!-- nothing; T's documentation already copied/exists --> | :<strong class="error">Please copy <nowiki>{{T}}</nowiki>'s documentation from [[w:c:templates:Template:T/doc]] to [[Template:T/doc]]!</strong>}}<!--
+
: This template is used to insert documentation on template pages.
-->{{#ifexist: Template:Tocright | <!-- nothing; Tocright already copied/exists --> | :<strong class="error">Please copy <nowiki>{{Tocright}}</nowiki> from [[w:c:templates:Template:Tocright]] to [[Template:Tocright]]!</strong>}}<!--
 
-->{{#ifexist: Template:Tocright/doc | <!-- nothing; Tocright's documentation already copied/exists --> | :<strong class="error">Please copy <nowiki>{{Tocright}}</nowiki>'s documentation from [[w:c:templates:Template:Tocright/doc]] to [[Template:Tocright/doc]]!</strong>}}<!--
 
-->{{#ifexist: Template:SPW | <!-- nothing; SPW already copied --> | :<strong class="error">Please copy <nowiki>{{SPW}}</nowiki> from [[w:c:templates:Template:SPW]] to [[Template:SPW]]!</strong>}}<!--
 
-->{{#ifexist: Template:SPW/doc | <!-- nothing; SPW's documentation already copied --> | :<strong class="error">Please copy <nowiki>{{SPW}}</nowiki>'s documentation from [[w:c:templates:Template:SPW/doc]] to [[Template:SPW/doc]]!</strong>
 
  
}}<!-- you can remove this line and everything above it if you don't see any big bold red text -->
+
; Dependencies
;Description
+
:; Uses
:This template is used to insert documentation on template pages.
+
:: {{T|Documentation/preload}} when no actual documentation is added yet.
;Syntax
 
:Type <code>&lt;noinclude>{{t|documentation}}&lt;/noinclude></code> at the end of the template page.
 
  
==General usage==
+
; Syntax
===On the Template page===
+
: 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>{{Documentation}}</noinclude></nowiki></code> to the end of the template page, so it looks like the below:
 
<pre>
 
<pre>
Template code<includeonly>Any categories to be inserted into articles by the template</includeonly><noinclude>
+
TEMPLATE CODE HERE
 +
Template code
 +
<includeonly> Any categories to be inserted into articles by the template</includeonly><noinclude>
 
{{documentation}}</noinclude>
 
{{documentation}}</noinclude>
 
</pre>
 
</pre>
  
===On the Template/doc page===
+
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.
 +
 
 
:''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.
+
; Dependencies
;Sample output
+
:; Uses
:<code>&lt;nowiki>{{templatename|foo}}</nowiki></code> gives...
+
:: Resource used by this template (Use linking or {{T}} where possible)
:{{templatename|foo}}
+
:: 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 ...
  
<includeonly>Any categories for the template itself</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
+
; Sample
 +
: <code>&lt;nowiki>{{templatename}}</nowiki></code> gives...
 +
: {{templatename}}
 +
 
 +
<includeonly>[[Category:Any categories for the template itself]]</includeonly><noinclude>
 +
[[Category:Template documentation]]</noinclude>
 
</pre>
 
</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}}.
+
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 ==
 +
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.
 +
 
 +
{{SPW|is newer|name=Documentation}}
 +
 
  
==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>
 
<includeonly>
[[Category:General wiki templates|{{PAGENAME}}]]
+
[[Category:Maintenance templates]]
 
</includeonly>
 
</includeonly>
 
<noinclude>
 
<noinclude>
[[Category:Template documentation|{{PAGENAME}}]]
+
[[Category:Template documentation]]
 
</noinclude>
 
</noinclude>

Latest revision as of 14:48, 9 March 2023

Description
This template is used to insert documentation on template pages.
Dependencies
Uses
{{Documentation/preload}} when no actual documentation is added yet.
Syntax
Type <noinclude>{{Documentation</noinclude> at the end of the template page.

General usage

On the Template page

You should attach <noinclude>{{Documentation}}</noinclude> to the end of the template page, so it looks like the below:

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

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.

See also Template:Documentation/preload
; Description
: A short description of the purpose of the template.

; Dependencies
:; 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><nowiki>{{templatename}}</nowiki></code> gives...
: {{templatename}}

<includeonly>[[Category: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 further usage information sections.

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

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