Template:Dochead/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Ganaram inukshuk (talk | contribs)
m do not overcomplicate? (3/2)
ArrowHead294 (talk | contribs)
mNo edit summary
Line 5: Line 5:


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


'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words#Page names|Template:ROOTPAGENAME]].
'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words#Page names|Template:<nowiki>ROOTPAGENAME</nowiki>]].


where <code>ROOTPAGENAME</code> refers to the name of the page without the namespace or subpages.
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.
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.

Revision as of 23:56, 4 October 2024

This template automatically inserts the default documentation header 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 is a "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 temp= followed by the name of the template.

See also