Template:Dochead/doc: Difference between revisions

Ganaram inukshuk (talk | contribs)
m doc
Ganaram inukshuk (talk | contribs)
update doc
Line 10: Line 10:
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.


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


<blockquote>'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words #Page names|Template: <nowiki>{{ROOTPAGENAME}}</nowiki>]].</blockquote>
* <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 />


where <code>ROOTPAGENAME</code> is a [[mw:Help:Magic words|"magic word"]] that returns the name of the page without the namespace or subpages. This way, the link in the header will attempt to point to a template with the same name as the module, since this is mostly the case. If the template which calls the module has a different name, pass in <code>temp=</code> followed by the name of the template.
For modules, header options are as follows:


You can also directly specify the header using the <code>header</code> parameter.  
* <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.
 
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 ===