Template:Dochead/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
No edit summary
 
(51 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><hr><small>Documentation transcluded from [[/doc]]</small></includeonly>
{{dochead}}
This template automatically inserts the default documentation header:
{{template rating|rating=ready|details=Recently rewritten. When used on a template's doc page, it automatically finds and links to the Lua modules it uses.; If used on a module's /doc page, it links to its corresponding template, if applicable.


: {| style="margin: 15px 0px 15px 0px; width: 98%;"
This template replaces [[Template:Lua]]'s use on template documentation.}}
| <hr><small>Documentation transcluded from [[Template:Docheadwiki/doc|/doc]]</small>
This template automatically categorizes documentation by namespace, which eliminates the need to do this manually. Currently, it is configured to place templates, modules, and their documentation inside their respective categories:
|}


on templates and modules, while also providing a link to the documentation subpage. It is wrapped in a <code>&lt;span&gt;</code> element with a switchable <code>display</code> so that it is visible on the base page but not on the documentation page.
* [[:Category:Templates]]
* [[:Category:Lua modules]]
* [[:Category:Template documentation]]
* [[:Category:Module documentation]]


It also places items inside their respective categories, which eliminates the need to do this manually. Currently, it is configured to place templates inside [[:Category:Templates]] and modules inside [[:Category:Lua modules]].
=== Usage ===
This template is invoked by placing <code><nowiki>{{dochead}}</nowiki></code> at the top of a module or template's <code>/doc</code> subpage. Default messages can be displayed, depending on that module or template's use:


=== Usage ===
<code>metatemplate</code> (templates only)
This template is invoked by placing <code>{{((}}dochead{{))}}</code> at the top of a module or template's <code>/doc</code> subpage.
: <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This template is used to build other templates and should not be used standalone except for testing and simple usage.</span>
<code>metamodule</code> (modules only)
: <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module primarily provides functionality for other Lua modules and cannot be invoked by templates.</span>
<code>dualuse</code> (modules only)
: <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module may be invoked by templates by using its corresponding template, or used directly from other modules.</span>
<code>noinvoke</code> (default for modules only)
: <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module should not be invoked directly; use its corresponding template instead.</span>
 
When used on modules, this template will attempt to link to its corresponding template of the same name. If the template and module names differ, it can be passed in using <code>temp=Template name goes here</code>.
 
In either case, passing in <code>header=none</code> results in no message being displayed. A custom message may also be passed in.


=== See also ===
=== See also ===
* [[Template:Docheadwiki]] &ndash; Similar template, used mainly for templates which are more or less copied over from Wikipedia.
* [[Template: Documentation]] – inserts a documentation section onto a template or module.
 
* [[Template: Doc head Wikipedia]] – similar template, used mainly for templates borrowed from Wikipedia.
<noinclude>[[Category:Template documentation]]</noinclude>

Latest revision as of 09:28, 30 October 2025

This template is implemented by the Lua module Module:Dochead.
This template invokes the following functions: dochead from Dochead.
This documentation is for a ready template. This message indicates that a template is ready for use, or has recently been repaired. This message may be removed once this template has been used on several pages or once it is verified to work as intended.

Details: Recently rewritten. When used on a template's doc page, it automatically finds and links to the Lua modules it uses.; If used on a module's /doc page, it links to its corresponding template, if applicable.

This template replaces Template:Lua's use on template documentation.

This template automatically categorizes documentation by namespace, which eliminates the need to do this manually. Currently, it is configured to place templates, modules, and their documentation inside their respective categories:

Usage

This template is invoked by placing {{dochead}} at the top of a module or template's /doc subpage. Default messages can be displayed, depending on that module or template's use:

metatemplate (templates only)

Note: This template is used to build other templates and should not be used standalone except for testing and simple usage.

metamodule (modules only)

Note: This module primarily provides functionality for other Lua modules and cannot be invoked by templates.

dualuse (modules only)

Note: This module may be invoked by templates by using its corresponding template, or used directly from other modules.

noinvoke (default for modules only)

Note: This module should not be invoked directly; use its corresponding template instead.

When used on modules, this template will attempt to link to its corresponding template of the same name. If the template and module names differ, it can be passed in using temp=Template name goes here.

In either case, passing in header=none results in no message being displayed. A custom message may also be passed in.

See also