Template:Dochead/doc: Difference between revisions

Ganaram inukshuk (talk | contribs)
update doc
Ganaram inukshuk (talk | contribs)
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ {{ROOTPAGENAME}} }}
{{dochead}}
{{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.
 
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:
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:


Line 8: Line 11:


=== Usage ===
=== 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.
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:


For templates, header options are as follows:
<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>


* <code>metatemplate</code>: <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><br />
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>.
 
For modules, header options are as follows:
 
* <code>metamodule</code>: <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module primarily provides functionality for other Lua modules and cannot be invoked by templates.</span><br />
* <code>dualuse</code>: <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module may be invoked by templates using Template:<nowiki>{{ROOTPAGENAME}}</nowiki>, or used directly from other modules.</span><br />
* <code>noinvoke</code> (default): <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module provides functionality to a template and should not be invoked directly; use the corresponding template instead: Template:<nowiki>{{ROOTPAGENAME}}</nowiki>.</span><br />


In either case, passing in <code>header=none</code> results in no message being displayed. A custom message may also be passed in.
In either case, passing in <code>header=none</code> results in no message being displayed. A custom message may also be passed in.
The [[mw:Help:Magic words|"magic word"]] <code>ROOTPAGENAME</code> returns the name of the page without the namespace or subpages. By default, Lua modules that implement templates provide a link to a template of the same name. If this name is different, it can be passed in using <code>temp=Template name goes here</code>.


=== See also ===
=== See also ===
* [[Template: Documentation]] – inserts a documentation section onto a template or module.
* [[Template: Documentation]] – inserts a documentation section onto a template or module.
* [[Template: Doc head Wikipedia]] – similar template, used mainly for templates borrowed from Wikipedia.
* [[Template: Doc head Wikipedia]] – similar template, used mainly for templates borrowed from Wikipedia.
{{todo|update documentation|inline=1|text=Dochead should now be able support categories on both templates and modules. Now contains new default messages that came up a lot that the single "use this module's corresponding template" message cannot capture.}}