Template:Documentation: Difference between revisions

From Xenharmonic Wiki
Jump to navigation Jump to search
ArrowHead294 (talk | contribs)
mNo edit summary
ArrowHead294 (talk | contribs)
mNo edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{#ifeq: {{#titleparts: {{FULLPAGENAME}}||-1}}|doc||<div style="clear: both; margin: 1em 0 1em 0; border: 1px solid #a2a9b1; background-color: #ecfcf4; padding: 1em;">
<templatestyles src="documentation/styles.css" />{{#ifeq: {{#titleparts: {{FULLPAGENAME}}||-1}}|doc||<div class="documentation-container" style="margin-bottom: {{#ifeq: {{lc:{{NAMESPACE}}}}|module|1|0}}em;">
<div style="padding-bottom: 3px; border-bottom: 1px solid #aaa; margin-bottom: 1ex;">
<div class="documentation-startbox">
[[File:Test Template Info-Icon - Version (2).svg|50px]] <span style="font-size: 125%;">'''{{NAMESPACE}} documentation'''</span><span style="margin-left: 1em; font-size: 13px;">{{#ifexist: {{FULLROOTPAGENAME}}/doc|{{lbrack}}[[{{FULLROOTPAGENAME}}/doc|view]]{{rbrack}} {{lbrack}}[[Special:EditPage/{{FULLROOTPAGENAME}}/doc|edit]]{{rbrack}} {{lbrack}}[[Special:PageHistory/{{FULLROOTPAGENAME}}/doc|history]]{{rbrack}} {{lbrack}}[[Special:Purge/{{FULLROOTPAGENAME}}|purge]]{{rbrack}}|{{lbrack}}[[Special:EditPage/{{FULLROOTPAGENAME}}/doc|create]]{{rbrack}}}}</span></div>}}
[[File:Test Template Info-Icon - Version (2).svg|50px]] <span class="documentation-header">'''{{NAMESPACE}} documentation'''</span><span class="documentation-editsection">{{#ifexist: {{ARTICLEROOTPAGENAME}}/doc|{{lbrack}}[[{{ARTICLEROOTPAGENAME}}/doc|view]]{{rbrack}} {{lbrack}}[[Special:EditPage/{{ARTICLEROOTPAGENAME}}/doc|edit]]{{rbrack}} {{lbrack}}[[Special:PageHistory/{{ARTICLEROOTPAGENAME}}/doc|history]]{{rbrack}} {{lbrack}}[[Special:Purge/{{ARTICLEROOTPAGENAME}}|purge]]{{rbrack}}|{{lbrack}}[[Special:EditPage/{{ARTICLEROOTPAGENAME}}/doc|create]]{{rbrack}}}}</span></div>}}
{{{1|{{{{FULLROOTPAGENAME}}/doc}}}}}
{{{1|{{#ifexist: {{ARTICLEROOTPAGENAME}}/doc|{{{{ARTICLEROOTPAGENAME}}/doc}}|}}}}}
{{#ifeq: {{#titleparts: {{FULLPAGENAME}}||-1}}|doc||</div>}}<noinclude>[[Category:Documentation templates]]</noinclude>
{{#ifeq: {{#titleparts: {{FULLPAGENAME}}||-1}}|doc||</div>}}<noinclude>[[Category:Documentation templates]]</noinclude>

Latest revision as of 14:20, 25 May 2025

Template documentation[view] [edit] [history] [purge]
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.