Template:Wt/tum/documentation

[edit] Template documentation

Template:Distinguish Template:Wt/tum/Documentation subpage Template:Template shortcut Template:High-use Template:Wt/tum/Lua Template:Never substitute

The Template:Tlx template is used to contain the documented information and instructions of a certain template, usually from a /doc subpage. It can also be configured to load the content from other pages or be directly fed by text.

For detailed instructions on how and when to use this template, see Wikipedia:Template documentation (shortcut: WP:TDOC).

This template has two parts: the big "documentation box" with the documentation inside alongside a toolbar (the [view][edit][hist][purge] links), and the smaller "link box" that shows metadata about the documentation alongside the sandbox and testcases links.

Use of this template allows templates to be protected, where necessary, while allowing anyone to edit the documentation and categories.

General syntax

edit

Normally, the template is used without parameters and is placed inside Template:Tag at the bottom of the template page (see Template:Section link for more information):

<!--Last line of your template code--><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage -->
</noinclude>

Transcluding a different page

edit

To transclude a different page other than the /doc subpage, simply provide Template:Para like this:

<!--Last line of your template code--><noinclude>
{{Documentation|Template:Other page/doc}}
</noinclude>

Note that when loading the documentation from a page other than the local /doc subpage, it becomes tricky to handle the categories.

Using the Template:Para parameter

edit

The documentation can also be fed directly as text, by using the Template:Para parameter:

<!--Last line of your template code--><noinclude>
{{Documentation
 | content =
<!-- template documentation -->
}}</noinclude>

When using this parameter, the toolbar will not show. Note that the /doc subpage in the link box will still show up if it exists.

Also note that when Template:Para and Template:Para is specified, Template:Para takes precedence and always shows in the documentation box.

Advanced syntax

edit

Customizing the heading

edit

The heading in the documentation box changes depending on namespace. See the below list for the default text in each namespace:

  • Template namespace: Template documentation
  • Module namespace: Module documentation
  • Other namespaces: Documentation

To customize the heading, simply set the parameter Template:Para to anything you like, for example Template:Para.

Note that if the heading parameter is empty but defined (like Template:Para) the heading alongside the toolbar will not show.

The Template:Para parameter can be fed optional CSS values, like Template:Para. Not that you should omit quotation marks " " and add the ending semicolon ;.

edit

To customize the link box, simply set Template:Para to something else, like Template:Para.

To hide the link box, simply set Template:Para to off.

Testing

edit

You can simulate the output for a given page by using the Template:Para parameter. For example, if you use the code Template:Para, the template will behave exactly as if it were on the page Template:Edit protected, including showing the documentation from Template:Edit protected/doc, linking to Template:Edit protected/sandbox, etc. This parameter is useful for testing and is used extensively on the module testcases page.

Placement and tags

edit

Template:Further information This code should be added at the bottom of the template code page, with no space before Template:Tag (which causes extra whitespace to show on pages where the template is transcluded):

<!--Last line of your template code--><noinclude>
{{documentation}}
<!-- Add categories to the /doc subpage -->
</noinclude>

To automatically insert the above text, you can also use the substitution code shortcut Template:Tlxs.

Categories and interwikis

edit

Depending on where to the documentation is placed, it may be tricky to handle the categories and interwikis. See Template:Section link for information about adding these.

Technical details

edit

Automatic functions

edit

If the documentation page does not exist, the toolbar is replaced with a [create] link. It automatically creates the page with preloaded text with the basic documentation syntax. Preload text is also used for the /sandbox and /testcases [create] links.

The preload page for the /doc [create] link is Template:Documentation/preload. The preload pages for the /sandbox and /testcases links are Template:Documentation/preload-sandbox and Template:Documentation/preload-testcases. The preload page for the /sandbox [mirror] link is Template:Documentation/mirror.

This template also automatically adds

ERROR: This page is using an unprefixed version of template {{Tl}}

Create {{Wt/tum/Tl}} instead and replace all occurences of {{Tl}} in Wt/tum/ prefixed pages by that.
You may like to check 1 template in Category:Wt/tum/Templates using unprefixed template Tl first to remove all occurences from those templates which will fix the pages containing those templates too.
{{pp-template}} to a protected template page, so no need to manually add this template to protected pages. When this template is on a /sandbox subpage it automatically adds the

ERROR: This page is using an unprefixed version of template {{Tl}}

Create {{Wt/tum/Tl}} instead and replace all occurences of {{Tl}} in Wt/tum/ prefixed pages by that.
You may like to check 1 template in Category:Wt/tum/Templates using unprefixed template Tl first to remove all occurences from those templates which will fix the pages containing those templates too.
{{Template sandbox notice}} template.
edit

Depending on the namespace, the link box may have less features, or may not show up at all. The following table shows this:

Namespace Behavior
Template Full behavior
Module Full behavior, with the addition of a "create documentation" link when the page foes not exist
User Full behavior
Other namespaces Hidden, unless Template:Para is specified (which will show "The above documentation is transcluded from Template:Param")

Alongside that, if Template:Para or Template:Para is specified, the "Add categories to the /doc subpage" will not show.

Subject namespaces vs. talk namespaces

edit

This template is usually placed in the subject namespace. But in some cases this template needs to be on the Talk namespace:

  • In the MediaWiki namespace, since Template:Tag often does not work in system messages, and since the MediaWiki namespace needs to be kept clean for performance reasons.

When placed on talk pages, this template usually is placed near the top of the page and without Template:Tag tags.

The /doc, /sandbox and /testcases pages should normally be in the subject namespace, except in the namespaces that do not have the MediaWiki subpage feature enabled: Main, File, and MediaWiki. (Categories can have subpages, but documentation is created in the Category talk namespace to prevent creating empty categories. There are also a whole bunch of other technical reasons why the /doc page must be stored under the talk page for those (but only those) namespaces.

This template automatically points its [create] links for the /doc, /sandbox and /testcases to the right namespace.

Full syntax

edit
{{Documentation}}

or

{{Documentation
 | [path to documentation page]
}}

{{Documentation
 | content =
}}

or

{{Documentation
| [path to documentation page]
| heading-style = 
| heading = 
| link box = 
}}

or 

{{Documentation
| [path to documentation page]
| content = 
| heading-style = 
| heading = 
| link box = 
| page =
}}

Color scheme

edit
Wikipedia background colors for Template:Template link (Help:Using colors)
RGB HSV Color General usage Note
#ECFCF4 150°, 6%, 99%   Sample Current documentation background
B #00FF80 Template:Nowrap   Basic hue What we'd call the color
1 #A3BFB1 150°, 15%, 75%   Header border only
2 #CEF2E0 150°, 15%, 95%   Main border; header background
3 #E6FFF2 150°, 10%, 100%   2nd header, accent colour
4 #F5FFFA 150°, 4%, 100%   Main background So saturation in A is a bit off

Template:Collapse top As a suggestion, here are colors for a navbox intended for documentation pages only. They follow the shading of regular blue navbox colors:

| titlestyle = background:#ccffe5
| basestyle  = background:#ddffee
<!-- basestyle= sets groupstyle, abovestyle, belowstyle together -->

For subgroups, in child navboxes:

{{Navbox|child
| groupstyle = background:#e6fff2
...

Example:Template:Template link expanded Template:Collapse bottom

See also

edit

ERROR: This page is using an unprefixed version of template {{Tl}}

Create {{Wt/tum/Tl}} instead and replace all occurences of {{Tl}} in Wt/tum/ prefixed pages by that.
You may like to check 1 template in Category:Wt/tum/Templates using unprefixed template Tl first to remove all occurences from those templates which will fix the pages containing those templates too.

{{Documentation subpage}}, a notice placed at the top of a /doc subpage explaining its role and including a link to the page it documents.

ERROR: This page is using an unprefixed version of template {{Tl}}

Create {{Wt/tum/Tl}} instead and replace all occurences of {{Tl}} in Wt/tum/ prefixed pages by that.

You may like to check 1 template in Category:Wt/tum/Templates using unprefixed template Tl first to remove all occurences from those templates which will fix the pages containing those templates too.

{{Barnstar documentation}}, a variant of

ERROR: This page is using an unprefixed version of template {{Tl}}

Create {{Wt/tum/Tl}} instead and replace all occurences of {{Tl}} in Wt/tum/ prefixed pages by that.
You may like to check 1 template in Category:Wt/tum/Templates using unprefixed template Tl first to remove all occurences from those templates which will fix the pages containing those templates too.

{{Documentation}} for use with barnstar templates.