Template:Documentation: Difference between revisions

From Sword of Moonlight Wiki
Jump to navigation Jump to search
dlw>Alex4401
No edit summary
m 1 revision imported
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><!--
<includeonly>{| class="article-table" style="width:100%; border: 1px solid;"
 
|-  
--><div class="documentation"><!--
! Template documentation follows
--><div class="documentation-header"><!--
|-
-->[[File:Template-{{#ifexist:{{#vardefineecho:docpage|{{{1|Template:{{#replace:{{{1|{{PAGENAME}}/doc}}}|Template:|}}}}}<!-- end vde -->}}|{{#if:{{{baddoc|}}}|bad}}|no}}info.svg|50px|link=]] <!--
| ''Note: the template above may sometimes be partially or fully invisible.''
--><span style="font-weight: bold; font-size: 125%; margin-right: 10px;">Documentation</span> <!--
|-
-->{{#ifeq:{{SUBPAGENAME}}|doc|<!--nothing-->|<!--
| Visit [[Template:{{PAGENAMEE}}/doc]] to edit this documentation. ([[Template:Documentation|How does this work?]])
-->{{#ifexist:{{#var:docpage}}|<!--
|}
--><span style="font-size: 90%; font-style: italic;"><!--
<div style="margin:0 1em;">
-->[{{fullurl:{{#var:docpage}}|action=edit}} Edit] this documentation at [{{fullurl:{{#var:docpage}}|redirect=no}} {{FULLPAGENAMEE:{{#var:docpage}}}}].<!--
{{{{PAGENAME}}/doc}}</div></includeonly><noinclude>{{documentation}}[[Category:Template documentation| ]]</noinclude>
--></span><!--
-->}}<!--
-->}}<!--
--><div style="float: right; margin-left: 5px;"><!--
-->[{{fullurl:{{FULLPAGENAMEE}}|action=purge}} purge]<!--
--></div><!--
--></div><!--
<!-- leave line break here -->
{{#if:{{{lua|}}}|{{UsesLua|{{{lua}}} }} }}
<!-- documentation text/error box begins here -->
<div style="border-radius: 5px; border: 2px solid var(--wiki-content-border-color); margin: 0.5em auto 1em; padding: 0.8em 1.2em; background: var(--wiki-content-background-color--secondary);">
<!--
-->{{#ifexist:{{#var:docpage}}|<!--
 
 
If there is documentation
 
-->
{{ {{#var:docpage}} }}
<!--
 
 
Else
 
-->|<!--
-->No documentation subpage exists yet for this template. [{{fullurl:{{FULLPAGENAMEE:Template:{{{1|{{PAGENAME}}}}}}}/doc|action=edit&preload=Template:Doc/preload}} Create one now].<!--
-->[[Category:Templates with no documentation]]<!--
-->}}<!-- leave line break here -->
<!-- documentation text/error box ends here -->
</div>
<!-- -->{{#ifeq:{{SUBPAGENAME}}|doc|<!--
-->{{#ifeq:{{BASEPAGENAME}}|Doc|<!--nothing-->|<!-- only if page is not Template:Doc
-->This is the documentation page, it should be transcluded into the main template page. See {{tlx|doc}} for more information. <!--
-->[[Category:Template documentation]]<!--
-->}}<!--
-->}}<!--
--></div><!--
 
--></includeonly><!--
 
--><noinclude>{{Documentation}}
[[Category:Documentation templates| ]]
</noinclude>

Latest revision as of 18:53, 12 September 2024

Template documentation follows
Note: the template above may sometimes be partially or fully invisible.
Visit Template:Documentation/doc to edit this documentation. (How does this work?)

Description

This template is used to insert descriptions on template pages.

Syntax

Add <noinclude>{{documentation}}</noinclude> at the end of the template page.

Usage

On the Template page

This is the normal format when used:

TEMPLATE CODE<includeonly>Any categories to be inserted into articles by the template</includeonly><noinclude>
{{documentation}}</noinclude>

If your template is not a completed div or table, you may need to close the tags just before {{documentation}} is inserted (within the noinclude tags).

A line break right before {{documentation}} can also be useful as it helps prevent the documentation template "running into" previous code.

On the Template/doc page

Normally, you will want to write something like the following on the documentation page:

==Description==
This template is used to do something.

==Syntax==
Type <code>{{t|templatename}}</code> somewhere.

==Samples==
<code><nowiki>{{templatename|input}}</nowiki></code> 

results in...

{{templatename|input}}

<includeonly>Any categories for the template itself</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>

Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or other sections.

Note that the above example also uses the Template:T and Template:T/piece templates.