Template:Dochead/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
ArrowHead294 (talk | contribs)
mNo edit summary
Line 16: Line 16:


<blockquote class="toccolours">
<blockquote class="toccolours">
'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words#Page names|Template:&laquo;ROOTPAGENAME&raquo;]].
'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words#Page names|Template:ROOTPAGENAME]].
</blockquote>
</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.
where {{nowrap|&laquo;ROOTPAGENAME&raquo;}} refers to 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, but the template which calls the module is named differently, pass in <code>temp=</code> followed by the name of the template.


=== See also ===
=== See also ===

Revision as of 15:08, 16 September 2024

This template automatically inserts the default documentation header:


Documentation transcluded from /doc

onto the main pages for certain items (mostly templates and modules), while also providing a link to the documentation subpage.

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).

Usage

This template is invoked by placing {{dochead}} at the top of a module or template's /doc subpage.

On modules, unless header=none is passed, a header will appear to inform users that modules should be called via templates instead of being invoked directly:

Note: Do not invoke this module directly; use the corresponding template instead: Template:ROOTPAGENAME.

where «ROOTPAGENAME» refers to 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, but the template which calls the module is named differently, pass in temp= followed by the name of the template.

See also