Difference between revisions of "Template:Documentation"

From Team Fortress Wiki
Jump to: navigation, search
(I think I got it right.)
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div style="border:1px solid #aaa; background:#F2F2FC; padding:0.75em; margin:0.5em 0;">
+
<div id="template-documentation" style="clear: both; margin: 1em 0 0 0; border: 1px solid #aaa; background-color: #ecfcf4; padding: 1em; font-family: sans-serif">
<div style="float: right;" class="plainlinks">&#91;[[{{{1|{{FULLPAGENAME}}/doc}}}|view]]&#93;&nbsp;&#91;[{{fullurl:{{{1|{{FULLPAGENAMEE}}/doc}}}|action=edit}} edit]&#93;&nbsp;&#91;[{{fullurl:{{{1|{{FULLPAGENAMEE}}/doc}}}|action=purge}} purge]&#93;
+
<div style="padding-bottom:3px;border-bottom:1px solid #aaa;margin-bottom:1ex">
 +
<span style="font-weight:bold;font-size:125%">Template documentation </span>
 +
<span id="doc-editlinks" class="plainlinks">{{#ifexist:{{FULLPAGENAME}}/doc|&#91;[[{{FULLPAGENAME}}/doc|view]]&#93; &#91;[{{fullurl:{{FULLPAGENAME}}/doc|edit}} edit]&#93; &#91;[{{fullurl:{{FULLPAGENAME}}/doc|history}} history]&#93; &#91;[{{fullurl:{{FULLPAGENAME}}|purge}} purge]&#93;|{{#if:{{{1|}}}||&#91;[https://wiki.teamfortress.com/wiki/{{FULLPAGENAME}}/doc?action=edit&preload=Template:Documentation/preload create]&#93;}}}}</span>
 +
</div>
 +
{{#ifexist:{{FULLPAGENAME}}/doc|{{{{PAGENAME}}/doc}}|{{{1|}}}}}
 
</div>
 
</div>
<h1 style="margin-top:-0.25em; margin-bottom: 0.25em;">Documentation for ''{{{1|{{PAGENAME}}}}}''</h1><includeonly>
 
{{ #ifexist: {{{content|{{NAMESPACE}}:{{PAGENAME}}/doc}}}  | {{{{{content|{{NAMESPACE}}:{{PAGENAME}}/doc}}}}} | }}
 
</div></includeonly><includeonly>
 
{{ #ifexist: {{{1|{{NAMESPACE}}:{{PAGENAME}}/doc}}} | <!-- /doc exists -->
 
<div style="border:1px solid #aaa; background:#F2F2FC; padding:0.5em;">
 
::[[Image:Template_info.png|40px|link={{NAMESPACE}}:{{PAGENAME}}/doc]]  ''This [[:Category:Template documentation|documentation]] is transcluded from [[{{{1|{{NAMESPACE}}:{{PAGENAME}}/doc}}}]]''.
 
</div> |<!-- no /doc --> }}</includeonly>__NOEDITSECTION__<noinclude>
 
== Usage ==
 
* Place {{tl|Template doc}} inside {{code|<noinclude>}} tags on a template page to display [[:Category:Template documentation|template documentation]].
 
* Generally template documentation should only be used on complex templates with multiple parameters. The majority of templates won't need a separate documentation subpage.
 
* If you want to have documentation displayed without a subpage, but with the green box, use {{tl|Doc begin}}.
 
 
[[Category:Template documentation| ]]
 
[[Category:Templates|Template doc]]
 
</noinclude>
 

Revision as of 22:29, 8 August 2020

Template documentation [view] [edit] [history] [purge]

This template is used to show documentation that explains other templates.

Usage

Add this template to the end of other templates while wrapped in <noinclude> tags to show the documentation. It will show the /doc subpage of the template in a green box.

<!--Last line of your template code--><noinclude>
{{Documentation}}
<!-- Add categories to the /doc subpage, not here -->
</noinclude>

Alternatively, you can use a parameter for documentation instead of creating a /doc page:

<!--Last line of your template code--><noinclude>
{{Documentation|
<!--Documentation goes here-->
}}
</noinclude>