Template:Dochead: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
Ganaram inukshuk (talk | contribs)
leap of faith
Tags: Replaced Reverted
Ganaram inukshuk (talk | contribs)
Undo revision 215013 by Ganaram inukshuk (talk) rollback due to interference with other templates
Tag: Undo
Line 1: Line 1:
<includeonly>{{#invoke: Dochead | dochead }}</includeonly><noinclude>
<includeonly>{{#switch: {{lc: {{NAMESPACE}}}}
| template =
  {{#switch: {{lc: {{{header|}}}}}
  | metatemplate = <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 />
  | luabased    = <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This template invokes function '''{{{func|_{{lc: {{{ROOTPAGENAME}}}}}}}}''' in [[Module:{{{mod|{{ROOTPAGENAME}}}}}]] using Lua.</span><br />
  | luameta      = <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This template invokes function '''{{{func|_{{lc: {{{ROOTPAGENAME}}}}}}}}''' in [[Module:{{{mod|{{ROOTPAGENAME}}}}}]] using Lua, and is used to build other templates. This template should not be used standalone except for testing and simple usage.</span><br />
  | none        =
  | #default    = {{{header|}}}
  }}
  {{#ifeq: {{#titleparts: {{FULLPAGENAME}}||-1}} | doc
  | [[Category:Template documentation]]
  | [[Category:Templates]]
{{#ifeq: {{lc: {{header|}}}} | luabased | [[Category:Lua-based templates]] }}{{#ifeq: {{lc: {{header|}}}} | luameta | [[Category:Lua-based templates]] }}
  }}
 
| module =
  {{#switch: {{lc: {{{header|noinvoke}}}}}
  | metamodule = <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module primarily provides functionality for other Lua modules and cannot be invoked by templates.</span><br />
  | dualuse    = <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module may be invoked by templates by using its corresponding [[Template:{{{temp|{{ROOTPAGENAME}}}}} | template]], or used directly from other modules.</span><br />
  | noinvoke  = <span style{{=}}"margin-bottom: 0.5em;">'''Note:''' This module should not be invoked directly; use its corresponding [[Template:{{{temp|{{ROOTPAGENAME}}}}} | template]] instead.</span><br />
  | none      =
  | #default  = {{{header|}}}
  }}
  {{#ifeq: {{#titleparts: {{FULLPAGENAME}}||-1}} | doc
  | [[Category:Module documentation]]
  | [[Category:Lua modules]]
  }}
 
| #default = This template is in the wrong namespace. It should be used within the Template or Module namespace.
}}</includeonly><noinclude>
{{documentation}}
{{documentation}}


[[Category:Documentation templates]]
[[Category:Documentation templates]]
</noinclude>
</noinclude>

Revision as of 09:15, 28 October 2025

Template documentation[view] [edit] [history] [purge]
Template:Dochead is ready for use. This message indicates that a template is ready for use, or has recently been repaired. This message may be removed once this template has been used on several pages or once it is verified to work as intended.

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:

Usage

This template is invoked by placing {{dochead}} at the top of a module or template's /doc subpage. Default messages can be displayed, depending on that module or template's use:

metatemplate (templates only)

Note: This template is used to build other templates and should not be used standalone except for testing and simple usage.

metamodule (modules only)

Note: This module primarily provides functionality for other Lua modules and cannot be invoked by templates.

dualuse (modules only)

Note: This module may be invoked by templates by using its corresponding template, or used directly from other modules.

noinvoke (default for modules only)

Note: This module should not be invoked directly; use its corresponding template instead.

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 temp=Template name goes here.

In either case, passing in header=none results in no message being displayed. A custom message may also be passed in.

See also