Template:Documentation/doc: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
No edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(27 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{dochead}}
{{Dochead}}{{substitute|no}}{{wikipedia}}{{templatestyles}}
The {{tlx|documentation}} template is used to contain the documented information and instructions of a certain template or module. The actual information is located in the <code>/doc</code> subpage.
The <code><nowiki>{{documentation}}</nowiki></code> template is used to contain information and instructions for templates and modules. Wikipedia's documentation template has modules that help render the dialog boxes, but here the box is hard-coded to simplify things.
__NOTOC__
=== Usage ===
This template automatically extracts contents from the <code>/doc</code> subpage of any page. You can optionally add an unnamed argument, which will be displayed in place.  


You can use <code>{{((}}doc{{))}}</code> (with no slash in front) as a shortcut.
==== Templates ====
On templates, place <code><nowiki>{{documentation}}</nowiki></code> on the page itself, place the relevant categories afterwards, and enclose them in <code><nowiki><noinclude></nowiki></code> tags:
 
<pre>
<noinclude>
{{Documentation}}
 
[[Category: …]]
</noinclude>
</pre>
 
==== Modules ====
On pages consisting of exclusively code (modules, CSS, JS, etc.), place this template on the <code>/doc</code> subpage and pass the notes, along with {{tlx|dochead}}, in as the first unnamed parameter:
 
<pre>
{{Documentation|
{{Dochead}}
}}
</pre>
 
{{Escape notice}}
 
Additionally, when {{tlx|lua}} is used on a module documentation page to indicate dependencies, the first paragraph of text after the Lua banner may need to be encased in its own paragraph (<code><nowiki><p></nowiki></code>) element since otherwise the MediaWiki parser may fail to render the paragraphs correctly:
 
<pre>
{{Documentation|
{{Dochead}}{{lua|…|…|}}
<p>Paragraph 1</p>
 
Paragraph 2
 
Paragraph 3
}}
</pre>
 
=== See also ===
* [[Template: Dochead]] – used to categorise and add appropriate headers onto documentation pages.

Latest revision as of 23:09, 25 May 2025

This template should not be substituted.
English Wikipedia has an article on:

The {{documentation}} template is used to contain information and instructions for templates and modules. Wikipedia's documentation template has modules that help render the dialog boxes, but here the box is hard-coded to simplify things.

Usage

This template automatically extracts contents from the /doc subpage of any page. You can optionally add an unnamed argument, which will be displayed in place.

Templates

On templates, place {{documentation}} on the page itself, place the relevant categories afterwards, and enclose them in <noinclude> tags:

<noinclude>
{{Documentation}}

[[Category: …]]
…
</noinclude>

Modules

On pages consisting of exclusively code (modules, CSS, JS, etc.), place this template on the /doc subpage and pass the notes, along with {{dochead}}, in as the first unnamed parameter:

{{Documentation|
{{Dochead}}
…
}}

Note: Pipe characters (|) must be escaped as {{!}} or {{pipe}}, equals signs must be escaped as {{=}} (this may apply to tags as well, e.g. <div style{{=}}"…">), and other special characters and character sequences may need to be escaped accordingly, except for ones inside <nowiki>, <pre>, <math>, and <syntaxhighlight> tags.

Additionally, when {{lua}} is used on a module documentation page to indicate dependencies, the first paragraph of text after the Lua banner may need to be encased in its own paragraph (<p>) element since otherwise the MediaWiki parser may fail to render the paragraphs correctly:

{{Documentation|
{{Dochead}}{{lua|…|…|}}
<p>Paragraph 1</p>

Paragraph 2

Paragraph 3
…
}}

See also

  • Template: Dochead – used to categorise and add appropriate headers onto documentation pages.