Difference between revisions of "Template:Documentation"

From DDwiki
Jump to: navigation, search
(Created page with '<!-- Automatically add {{template sandbox notice}} when on a /sandbox page. -->{{#ifeq: {{SUBPAGENAME}} | sandbox | <div style="clear: both;"></div>{{template sandbox notice|{{…')
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!--
+
<div style="background-color:#ECFCF4;border:1px solid #AAA;clear:both;margin:1em 0 0;padding:1em">
  Automatically add {{template sandbox notice}} when on a /sandbox page.
+
<div style="padding-bottom:3px;border-bottom:1px solid #aaa;margin-bottom:1ex">
-->{{#ifeq: {{SUBPAGENAME}} | sandbox
+
<span class="editsection plainlinks" id="doc_editlinks" style="float:right;margin-left:5px">
| <div style="clear: both;"></div>{{template sandbox notice|{{{livepage|}}}}}
+
[[{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=edit}} edit]] [[{{fullurl:{{{docpage|{{FULLPAGENAME}}/doc}}}|action=history}} history]] [[{{fullurl:{{{docpage|{{FULLPAGENAME}}}}}|action=purge}} purge]]
}}<!--
+
</span>
  Automatically add {{pp-template}} to protected templates.
+
<span style="font-weight:bold;font-size:125%">
-->{{template other
+
[[File:Template-info.png|link=|alt=Documentation icon]]
| {{#ifeq: {{PROTECTIONLEVEL:move}} | sysop
+
Template documentation
  | {{pp-template|docusage=yes}}
+
</span>
  | {{#if: {{PROTECTIONLEVEL:edit}}
+
</div>
    | {{pp-template|docusage=yes}}
+
{{Template:{{PAGENAME}}/doc }}
    | <!--Not protected, or only semi-move-protected-->
+
</div>
    }}
+
  }}
+
}}<!--
+
  Start of green doc box.
+
-->{{documentation/start box2
+
| preload = {{{preload|}}}  <!--Allow custom preloads-->
+
| heading = {{{heading|¬}}}  <!--Empty but defined means no header-->
+
| heading-style = {{{heading-style|}}}
+
| content = {{{content|}}}
+
 
+
<!--Some namespaces must have the /doc, /sandbox and /testcases
+
    in talk space-->
+
| docspace = {{documentation/docspace}}
+
 
+
| 1 = {{{1|}}}  <!--Other docname, if fed-->
+
 
+
<!--The namespace is added in /start box2-->
+
| template page = {{documentation/template page}}
+
 
+
}}<!-- Start content --><!--
+
  Start load the /doc content:
+
  Note: The line breaks between this comment and the next line are necessary
+
  so  "=== Headings ===" at the start and end of docs are interpreted.
+
-->
+
{{#switch: {{#if:{{{content|}}}|1|0}}{{#if:{{{1|}}}|1|0}}{{#ifexist:{{{1|}}}|1|0}}{{#ifexist:{{documentation/docspace}}:{{documentation/template page}}/doc|1|0}}
+
| 1000 | 1001 | 1010 | 1011 | 1100 | 1101 | 1110
+
| 1111 = {{{content|}}}
+
| 0110 | 0111 = {{ {{{1}}} }}
+
| 0001 | 0011 = {{ {{documentation/docspace}}:{{documentation/template page}}/doc }}
+
| 0000 | 0100 | 0010 | 0101 =  
+
}}
+
<!--
+
  End load the /doc content:
+
  Note: The line breaks between this comment and the previous line are necessary
+
  so  "=== Headings ===" at the start and end of docs are interpreted.
+
-->{{documentation/end box2
+
| preload = {{{preload|}}}  <!--Allow custom preloads-->
+
| content = {{{content|}}}
+
| link box = {{{link box|}}}  <!--So "link box=off" works-->
+
 
+
<!--Some namespaces must have the /doc, /sandbox and /testcases
+
    in talk space-->
+
| docspace = {{documentation/docspace}}
+
 
+
| 1 = {{{1|}}}  <!--Other docname, if fed-->
+
 
+
<!--The namespace is added in /end box2-->
+
| template page = {{documentation/template page}}
+
 
+
}}<!--
+
  End of green doc box
+
--><noinclude>
+
 
+
<!-- Add categories and interwikis to the /doc subpage, not here! -->
+
</noinclude>
+

Latest revision as of 01:24, 16 April 2012

[edit] [history] [purge] Documentation icon Template documentation

This is the {{documentation}} template.

This template displays a green doc box like you are seeing now, and automatically loads the content from a /doc subpage.

Usage

This template is used without any parameters, placed at the bottom of the template or page being documented, within <noinclude>:

<!--Last line of your template code--><noinclude>

{{documentation}}
<!-- Add categories to the /doc subpage, not here! -->
</noinclude>

Then this template automatically loads the content from the /doc subpage of the template it is used on.

Best practice

The code should be added at the bottom of the template code, with no space before <noinclude> (which would cause extra space on pages where the template is used).

Categories and interwiki links that apply to the template itself should be added to the bottom of the /doc subpage, inside <includeonly>...</includeonly> tags.

If the documentation page contains <includeonly> or <noinclude> tags as part of the visible documentation text, replace the "<" with "&lt;".

Documentation pages

Documentation pages should end with the category links for both the documentation page and the template itself, in the following way:

<includeonly>[[Category:CATEGORY TO WHICH THE TEMPLATE BELONGS]]</includeonly>
<noinclude>[[Category:Template documentation]]</noinclude>