Template:Dochead/doc: Difference between revisions

ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(23 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><hr /><span style="font-size: 0.75em;">Documentation transcluded from [[/doc]]</span></includeonly>
{{ {{ROOTPAGENAME}} }}
This template automatically inserts the default documentation header:
This template automatically categorizes documentation by namespace, 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]]).


: {| style="background-color: #f8f9fa; border: 1px solid #eaecf0; margin: 15px 0px 15px 0px; width: 95%;"
=== Usage ===
| <hr /><span style="font-size: 0.75em;">Documentation transcluded from [[/doc]]</span>
This template is invoked by placing <code><nowiki>{{dochead}}</nowiki></code> at the top of a module or template's <code>/doc</code> subpage.
|}
 
onto the main pages for certain items (mostly templates and modules), while also providing a link to the documentation subpage.
 
The header is wrapped in a <code>&lt;span&gt;</code> element so it can be hidden on documentation pages but visible on main pages where they are transcluded.
 
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 ===
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:
This template is invoked by placing <code>{{((}}dochead{{))}}</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 which points to the template invoked:
'''Note:''' Do not invoke this module directly; use the corresponding template instead: [[mw:Help:Magic words#Page names|Template:<nowiki>{{ROOTPAGENAME}}</nowiki>]].


: {| style="background-color: #f8f9fa; border: 1px solid #eaecf0; width: 95%;"
where <code>ROOTPAGENAME</code> is a [[mw:Help:Magic words|"magic word"]] that returns the name of the page without the namespace or subpages.
| '''Note:''' Do not invoke this module directly; use the corresponding template instead: [[Template:{{ROOTPAGENAME}}]].
|}


The linked template can be changed by passing <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.


=== See also ===
=== See also ===
* [[Template:Doc head Wikipedia]] &ndash; Similar template, used mainly for templates borrowed from Wikipedia.
* [[Template: Documentation]] – inserts a documentation section onto a template or module.
 
* [[Template: Doc head Wikipedia]] – similar template, used mainly for templates borrowed from Wikipedia.
<noinclude>[[Category:Template documentation]]</noinclude>