Template:Dochead/doc: Difference between revisions

ArrowHead294 (talk | contribs)
Ganaram inukshuk (talk | contribs)
No edit summary
 
(27 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><hr /><span style="font-size: 0.75em;">Documentation transcluded from [[/doc]]</span></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.


<blockquote class="toccolours">
This template replaces [[Template:Lua]]'s use on template documentation.}}
<div><hr /><span style="font-size: 75%;">Documentation transcluded from [[/doc]]</span></div>
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:
</blockquote>


onto the main pages for certain items (mostly templates and modules), while also providing a link to the documentation subpage.
* [[:Category:Templates]]
 
* [[:Category:Lua modules]]
It also places items inside their respective categories, which eliminates the need to do this manually. Currently, it is configured to place modules and their documentation inside their respective categories ([[:Category:Lua modules]] and [[:Category:Module documentation]]).
* [[:Category:Template documentation]]
* [[:Category:Module documentation]]


=== Usage ===
=== Usage ===
This template is invoked by placing <code>{{((}}dochead{{))}}</code> at the top of a module or template's <code>{{!((}}/doc{{))!}}</code> subpage.
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:


On modules, unless <code>header=none</code> is passed, a header will appear to inform users that modules should be called via templates instead of being invoked directly:
<code>metatemplate</code> (templates only)
: <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>


<blockquote class="toccolours">
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>.
'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words#Page names|Template:&laquo;ROOTPAGENAME&raquo;]].
</blockquote>


By default, this will attempt to point to the template with the same name (here, {{nowrap|&laquo;ROOTPAGENAME&raquo;}} refers to the name of the page without the namespace or subpages), but this can be changed by passing <code>temp=</code> followed by the name of the template. Whether <code>Template:</code> is present in what is passed to <code>temp</code> doesn't matter, as long as a template with the specified name exists.
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:Documentation]] &ndash; Inserts a documentation section onto a template or module.
* [[Template: Documentation]] – inserts a documentation section onto a template or module.
* [[Template:Doc head Wikipedia]] &ndash; Similar template, used mainly for templates borrowed from Wikipedia.
* [[Template: Doc head Wikipedia]] – similar template, used mainly for templates borrowed from Wikipedia.
 
<noinclude>[[Category:Template documentation]]</noinclude>