Difference between revisions of "Template:Documentation/doc"
test>KylieTastic (Reverted 1 edit by 66.87.75.190 (talk): Rvt teste edit. (TW)) |
|||
| Line 5: | Line 5: | ||
This is the {{tl|Documentation}} template. | This is the {{tl|Documentation}} template. | ||
| − | + | within a {{tag|noinclude}}cumentation page contains {{tag|includeonly|o}} or {{tag|noinclude|o}} tags as part of the visible documentation text, replace the "<code><</code>" with "<code>&lt;</code>". | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
===Heading=== | ===Heading=== | ||
Revision as of 23:54, 23 May 2015
| This is a documentation subpage for Template:Documentation. It contains usage information, categories and other content that is not part of the original template page. |
| This template uses Lua: |
This is the {{Documentation}} template.
within a<noinclude>...</noinclude>cumentation page contains<includeonly>or<noinclude>tags as part of the visible documentation text, replace the "<" with "<".
Contents
Heading
When in the Template namespace, this template shows this heading:
In most other namespaces, such as "Wikipedia:", it shows this heading:
- Documentation
But when on File (image) pages it shows this heading:
- Summary
The heading parameter can be used to set the heading to something else. Like this:
{{Documentation |heading=Infobox documentation}}
If the heading parameter is empty but defined, no heading is shown and no [edit] [purge] links are shown. Like this:
{{Documentation |heading=}}
The heading-style parameter can be fed optional CSS values. Without quotation marks " " but with the ending semicolons ;. For example:
heading-style=font-size:150%;color:red;
Link box
Below the big doc box is a small link box that shows some meta-data about the documentation. The link box shows different things depending on what parameters are fed to this template, and in which namespace it is used. In some cases the link box is not shown at all.
To hide the link box, add the parameter |link box=off.
You can also insert customised text in the link box, by defining the |link box= parameter. For example:
|link box=This documentation is automatically generated by [[Template:Country showdata]]
Automatic functions
If the documentation page does not exist, the [create] link includes a preload page so that clicking it will pre-fill the edit form with the basic documentation page format. Preload text is also used for the /sandbox and /testcases [create] links.
When this template is on a protected template page it now automatically adds {{pp-template}}, which shows the grey or red padlock in the top right corner. So no need to manually add {{pp-template}} to templates that use {{Documentation}}.
When this template is on a /sandbox subpage it automatically adds the {{Template sandbox notice}}.
Subject namespaces vs. talk namespaces
Terminology: Subject namespaces are the opposite of talk namespaces. For instance "Template:" is the subject space of "Template talk:".
This template is usually placed in a subject namespace, within <noinclude> tags. But in some cases this template needs to be on the talk page:
- In the Mediawiki namespace, since
<noinclude>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 <noinclude>...</noinclude> 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, Mediawiki and Category. (But currently we only show the /sandbox and /testcases links from User, User talk, Template and Template talk namespaces.) 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.
Testing
You can simulate the output for a given page by using the |page= parameter. For example, if you use the code |page=Template:Edit protected, 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.
Technical details
The preload page for the /doc [create] link is Template:Documentation/preload. The preload pages for the /sandbox and /testcases [create] links are Template:Documentation/preload-sandbox and Template:Documentation/preload-testcases.
For more details, see the talk page.
Full syntax
{{Documentation}}
{{Documentation
| content =
}}
{{Documentation
| [path to documentation page]
| heading-style =
| heading =
| link box =
}}
See also
- {{Documentation subpage}}, a notice placed at the top of a /doc subpage explaining its role and including a link to the page it documents.
- {{Barnstar documentation}}, a variant of {{Documentation}} for use with barnstar templates.
- {{Documentation/color scheme}} presents the color scheme used by {{Documentation}}.
- Wikipedia:Template documentation is a how-to guide to template documentation.
- Wikipedia:Template sandbox and test cases explains the use of /sandbox and /testcases subpages and includes more information about template testing.
- User:Technical 13/Scripts/editTemplateNoDoc.js, a beta script that enables documentation to be hidden by default when editing templates.