Difference between revisions of "Template:Documentation"

From Pangaea Wiki
Jump to: navigation, search
m
 
(4 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
     {{#switch: {{SUBJECTSPACE}}  
 
     {{#switch: {{SUBJECTSPACE}}  
 
     | {{ns:Template}} = [[File:Template_Info.png|50px|link=|alt=Documentation icon]] Template documentation ({{Navbar|{{PAGENAME}}/doc|text=}})<hr>
 
     | {{ns:Template}} = [[File:Template_Info.png|50px|link=|alt=Documentation icon]] Template documentation ({{Navbar|{{PAGENAME}}/doc|text=}})<hr>
 +
    | {{ns:Script}} = [[File:Template_Info.png|50px|link=|alt=Documentation icon]] Script documentation<hr>
 
     | {{ns:File}} = Summary <hr>
 
     | {{ns:File}} = Summary <hr>
 
     | #default = Documentation <hr>
 
     | #default = Documentation <hr>
Line 26: Line 27:
 
<!---
 
<!---
  
--->{{{{PAGENAME}}/doc}}
+
--->{{{{FULLPAGENAME}}/doc}}
 
</div>
 
</div>
 
<div style="
 
<div style="
Line 36: Line 37:
 
padding: 1em;">
 
padding: 1em;">
 
:The above documentation is transcluded from [[{{FULLPAGENAME}}/doc]].  
 
:The above documentation is transcluded from [[{{FULLPAGENAME}}/doc]].  
:Editors can experiment in this template's [[{{FULLPAGENAME}}/sandbox|sandbox]]
+
{{#ifeq: {{SUBJECTSPACE}} | {{ns:Template}}|:Editors can experiment in this template's [[{{FULLPAGENAME}}/sandbox|sandbox]]
:Please add categories to the [[{{FULLPAGENAME}}/doc|/doc]] subpage: {{Subpages|Subpages of this template}} within {{tag|includeonly}}
+
:Please add categories to the [[{{FULLPAGENAME}}/doc|'''/doc''' subpage ]] within {{tag|includeonly}} tags.}}
 
</div></includeonly></onlyinclude>
 
</div></includeonly></onlyinclude>
<noinclude>{{Documentation}}</noinclude>
+
{{Documentation}}

Latest revision as of 14:35, 31 October 2020

Documentation icon Template documentation ( view · talk · edit)

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. It also reduces server resources by circumventing a technical limitation of templates

Simply add the {{Documentation}} to the bottom of the page and save. If the page has /doc subpage, then it will automatically fill the documentation, else it will give you a easy red link that begs to be created.


Optional parameters

  • heading= you can set a custom title, but if you include this parameter but leave it empty then the title will be removed along with the "edit/view" links.
  • heading-style= lets you set custom style to the heading, such as the font-size.


Namespace detection

This template has the neat feature of detecting the namespace and applying the appropriate heading accordingly.

  • Tempalte: namespaces will get the fancy Template documentation with navbar links to the /doc subpage.
  • File: namespaces will get Summary heading and hides the info-panel at the bottom. Neat for when you really want to add information to a specific file.

Any other namespace will default to a simple Documentation as heading unless you use the optional heading parameter.

Documentation subpages

Here is an example of how a /doc subpage setup should look like to be proper.

Categories that should be applied to the template should always go between <includeonly> and </includeonly> so they will not apply themselves to the documentation.
{{Documentation subpage}}
<!-- Categories go at the bottom of this page and interwiki links -->

== Usage ==
 | parameter=

== See also ==

<includeonly>
<!-- Categories go here, and interwikis go here -->
</includeonly>

See also

The above documentation is transcluded from Template:Documentation/doc.
Editors can experiment in this template's sandbox
Please add categories to the /doc subpage within <includeonly>...</includeonly> tags.