Template:Template documentation

From Template Wiki, a repository of MediaWiki templates.
Jump to navigation Jump to search
edit · history · refresh · system messages · page info
The template Template documentation is hidden and visible only in embedding pages.

Template-info.png Template documentation edit · history · refresh · page infos
This template documentation is included from Template:Template documentation/doc

The template {{Template documentation}} calls subroutine doc from Module Template documentation. It implements a template documentation that updates automatically when the template is edited.

Documentation subpage

Insert following text into the documentation subpage and fill in the parameters

{{#invoke:Template documentation|dokuseite}}
<onlyinclude>
{{#invoke:Template documentation|doku
|p1=1|t1=|d1=|m1=|f1=<!-- p: name of parameter; t: description; d: default; m: m=1 when mandatory; f=following line; g=another following line -->
|p2=2|t2=|d2=|m2=|f2=
|count=<!-- number of parameters -->
|omp=<!-- add when should not rendered without params -->
|text=is missing description <!-- add description here -->
|aw1=<!-- add example 1, params seperated by , oder ; change the with trennzeichen=* -->
|rubrik= <!-- add the group name = name of template that creates group list -->
|tabwidth=
|descwidth=
|namewidth=
|defwidth=
|mandwidth=
|norender=
|noexpand=}}</onlyinclude>

Documentation preload page

Create a preload page with following content

<includeonly><onlyinclude>{{#invoke:Template documentation|dokuseite}}
<onlyinclude<noinclude />>
{{#invoke:Template documentation|doku
|p1=1|t1=|d1=|m1=|f1=<!-- p: name of parameter; t: description; d: default; m: m=1 when mandatory; f=following line; g=another following line -->
|p2=2|t2=|d2=|m2=|f2=
|count=<!-- number of parameters -->
|omp=<!-- add when should not rendered without params -->
|text=is missing description <!-- add description here -->
|aw1=<!-- add example 1, params seperated by , oder ; change the with trennzeichen=* -->
|rubrik= <!-- add the group name = name of template that creates group list -->
|tabwidth=
|descwidth=
|namewidth=
|defwidth=
|mandwidth=
|norender=
|noexpand=}}</onlyinclude<noinclude />></onlyinclude></includeonly>
<div style="background-color: #aaa;width:90%; border-radius: 1em; box-shadow: 0.1em 0.1em 0.5em rgba(0,0,0,0.75);;padding:0.5em;"><div style="background-color: #fff;padding:1em; border-radius: 0.5em;"><code style="white-space:pre-wrap">{{msgnw:Template:Template documentation/preload-doc}}
</code></div></div>

Module Template documentation

The module Template documentation provides a documentation for templates that is compact, transparent, flexible and always up-to-date. The documentation is included from a subpage and is structured in the way as described following.

Header

The header provides links to the subpage and the template itself for editing, history, page infos and refresh page. A short description should follow, what is the purpose, what are the requirements, which namespace to use...

Parameter list

A list of an arbitrary numbers of parameters can be entered and is displayed as table.

Copy&paste

By entering the parameter list a text for copy&paste for usage in the transcluding page is triggered.

Usage examples

Per default the application of the template with parameter default values is shown. It is always a good idea to provide good default values for all parameters if possible. The template is expanded and the wikitext is displayed, alongside with the result of the transclution of the template. This behaviour can be suppressed by parameters.

Up to ten different application cases can displayed on the page, the cases are entered as aw1=parm1=;parm2=;parm3=... The separation character can be changed in case it is part of one of the parameters. The expanded and rendered wikitext is displayed.

Wikitext

The raw text of the template is displayed using the lua function mw.text.nowiki(titel:getContent())

Subpages

A list of the existing subpages of the template is provided. Above this section links to template usage and documentation subpage are displayed.


Subpages

bottom