(Updated formatting.) |
(Updated the Documentation template from the Templates Wiki.) |
||
Line 1: | Line 1: | ||
<!-- |
|||
<includeonly>{| class="article-table plainlinks" style="width:100%" |
|||
- Documentation template |
|||
|- style="font-size:18px" |
|||
- A template used to show the contents of a documentation subpage |
|||
! style="padding:0" | <div style="width:100%; padding:3px 0; text-align:center" class="color1">Template Documentation</div> |
|||
- Note: Comments (<!-- --.>) are often used to avoid unnecessary line brakes or spaces. |
|||
|- |
|||
------------------------------------------- |
|||
| ''Note: portions of the template sample may not be visible without values provided.'' |
|||
- DISCLAIMER |
|||
|- |
|||
- THIS TEMPLATE IS COMPLEX!!! |
|||
| View or edit [[{{{1|Template:{{PAGENAMEE}}/doc}}}|this documentation]]. ([[Template:Documentation|About template documentation]]) |
|||
- |
|||
- EDIT AT YOUR OWN DISCRETION!!! |
|||
| Editors can experiment in this template's [{{fullurl:{{FULLPAGENAMEE}}/sandbox|action=edit}} sandbox] and [{{fullurl:{{FULLPAGENAMEE}}/testcases}} test case] pages. |
|||
-------------------------------------------- |
|||
|} |
|||
--><!-- |
|||
<div style="margin:0 1em"> |
|||
- Sandbox notice |
|||
{{{{{1|{{PAGENAME}}/doc}}}}}</div></includeonly><noinclude>{{Documentation}}</noinclude> |
|||
- Only shows if the subpage is a sandbox |
|||
--> |
|||
{{#ifeq: {{SUBPAGENAMEE}} | sandbox |
|||
| <div class="article-table" |
|||
style="padding:1.5em; margin:auto; border:1px solid #5556; border-bottom:1px solid #5556; width:75%; display:flex"> |
|||
<div> |
|||
[[File:Sandbox.svg|left|70px|link=|alt=]] |
|||
</div> |
|||
<div> |
|||
: This is a template sandbox subpage for [[{{NAMESPACE}}:{{BASEPAGENAME}}]]. |
|||
:{{#ifexist: {{{testcases|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}/testcases}}} |
|||
| See also the companion subpage for [[{{NAMESPACE}}:{{BASEPAGENAMEE}}/testcases|the testcases]]. |
|||
}} |
|||
</div> |
|||
</div> |
|||
}}<!-- |
|||
--><div class="template-documentation" style="clear:both; border:1px solid #5556; margin:1em"> |
|||
<!-- |
|||
- |
|||
- Header |
|||
- |
|||
--><div class="article-table" style="padding:1em; margin:0; border-bottom:1px solid #5556"><!-- |
|||
- |
|||
- Icon for documentation; will show red if documentation doesn't exist. Else shows the blue icon. |
|||
- Changes depends on the Namespace |
|||
- Disabled when heading is specified. |
|||
- |
|||
-->{{#if: {{{heading|}}} |
|||
| |
|||
| {{#switch: {{NAMESPACE}} |
|||
| {{ns:Template}} | {{ns:Module}} = |
|||
[[File:{{#if: {{{content|}}} | Documentation_icon |
|||
| {{#ifexist: {{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}/doc}}} |
|||
| Documentation_icon |
|||
| No Documentation_icon |
|||
}} |
|||
}}.svg|left|70px|link=|alt=|class=mobile-hidden]] |
|||
}} |
|||
}}<!-- |
|||
- Heading |
|||
--><span>'''{{#if: {{{heading|}}} | {{{heading|Documentation}}} | <!-- |
|||
-->{{#switch: {{SUBJECTSPACE}} |
|||
| {{ns:Module}} = Module Documentation |
|||
| {{ns:Template}} = Template Documentation |
|||
| {{ns:File}} = Summary |
|||
| #default = Documentation |
|||
}}<!-- |
|||
-->}} <span class=mobileonly>follows<br/></span>'''</span><!-- |
|||
- |
|||
- Tools section |
|||
- |
|||
-->{{#if: {{{heading}}} |<span style="float:right">[<!-- |
|||
-->{{#if: {{{content|}}} |
|||
| <!-- |
|||
Content parameter ([edit) |
|||
-->[{{fullurl:{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}} |
|||
| action=edit |
|||
}} edit] |
|||
| <!-- |
|||
Normal, when /doc exists ([view | edit | hist) |
|||
-->{{#ifexist: {{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}} |
|||
| [[{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}/doc}}}|view]]<!-- |
|||
--> | <!-- |
|||
-->[{{fullurl:{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}} |
|||
| action=edit |
|||
}} edit]<!-- |
|||
--> | [{{fullurl:{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}} |
|||
| action=history |
|||
}} history] |
|||
| <!-- |
|||
- No documentation ([create) |
|||
--> [{{fullurl:{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}} |
|||
| action=edit&preload=Template:Documentation/preload&summary={{urlencode:Create /doc subpage for [[{{{page|{{FULLPAGENAMEE}}}}}]]}}&editintro=Template:Documentation/editintro-doc |
|||
}} create] |
|||
}}<!-- End ifexist --> |
|||
}}<!-- End if content--><!-- |
|||
--> | [{{fullurl:{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}|action=purge}} purge]<!-- |
|||
-->]</span>|}}<!-- |
|||
--></div><!-- |
|||
- |
|||
- Main documentation |
|||
- |
|||
--><div style="padding: 1em; padding-bottom: 0; margin: 0;"> |
|||
<!-- |
|||
- |
|||
- Does this: |
|||
- - Check if (1 => page/doc => ../doc => page_name/doc) exists |
|||
- - Yes: Transclude (1 => page/doc => ../doc => page_name/doc) |
|||
- - No: Error text |
|||
- |
|||
-->{{Tocright}}<!-- |
|||
- The line break is important to keep headings. |
|||
--> |
|||
{{#ifexist: {{#if: {{{1|}}} |
|||
| {{{1|}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page|}}} |
|||
| {{#ifeq: {{SUBPAGENAME}} | sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}} |
|||
}}/doc |
|||
}} |
|||
| {{<!-- |
|||
-->{{#if: {{{1|}}} |
|||
| {{{1|}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page|}}} |
|||
| {{#ifeq: {{SUBPAGENAME}} | sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAME}} |
|||
| {{FULLPAGENAME}} |
|||
}} |
|||
}}/doc |
|||
}}<!-- |
|||
-->}} |
|||
| {{#if: {{{content|}}} |
|||
| |
|||
| <strong class=error>This template doesn't have any documentation yet!</strong> Help out by <!-- |
|||
-->[{{fullurl:{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}} |
|||
| action=edit&preload=Template:Documentation/preload&summary=<!-- |
|||
-->{{urlencode:Create /doc subpage for [[{{{page|{{FULLPAGENAMEE}}}}}]]}}<!-- |
|||
-->&editintro=Template:Documentation/editintro-doc |
|||
}} creating it]. {{#if: {{{nocat|}}}||[[Category:Templates without documentation]] }} |
|||
}} |
|||
}} |
|||
<!-- |
|||
- Content moved outside & below to keep wikitables and allow simultanious content and /doc page transcludion |
|||
--> |
|||
{{{content|}}} |
|||
<!-- |
|||
- The line break is important to keep headings. |
|||
--><!-- |
|||
- |
|||
- Bottom tools |
|||
- |
|||
--></div><!-- |
|||
--> |
|||
{{#ifeq: {{{footer|}}} | none |
|||
| |
|||
| <div class="article-table" style="clear:both; padding:.5em; margin:0; border-top:1px solid #5556; font-style:italic"> |
|||
{{#if: {{{footer|}}} | {{{footer}}} | |
|||
<!-- |
|||
- Documentation transclusion text |
|||
-->{{#if: {{{content|}}} |
|||
| <!-- Empty; we don't know where the documentation is. --> |
|||
| {{#ifexist: {{{1|{{{page|{{FULLPAGENAMEE}}/doc}}}}}} |
|||
| The above [[w:Help:Template documentation|documentation]] is [[mw:Help:Transclusion|transcluded]] from <!-- |
|||
-->[[{{{1|{{{page|{{FULLPAGENAME}}}}}/doc}}}]].<!-- |
|||
--> <small>([{{fullurl:{{{1|{{{page|{{FULLPAGENAMEE}}}}}/doc}}} |
|||
| action=edit |
|||
}} edit]<!-- |
|||
--> | [{{fullurl:{{{1|{{{page|{{FULLPAGENAMEE}}}}}/doc}}} |
|||
| action=history |
|||
}} history])</small> <br/> |
|||
| {{#ifexist: {{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}/doc}} |
|||
| This is the sandbox of [[{{{page|{{NAMESPACE}}:{{BASEPAGENAME}}}}}]]; [[w:Help:Template documentation|documentation]] is [[mw:Help:Transclusion|transcluded]] from [[{{{page|{{NAMESPACE}}:{{BASEPAGENAME}}}}}/doc]].<!-- |
|||
--> <small>([{{fullurl:{{{page|{{NAMESPACE}}:{{BASEPAGENAMEE}}}}}/doc |
|||
| action=edit |
|||
}} edit]<!-- |
|||
--> | [{{fullurl:{{{page|{{NAMESPACE}}:{{BASEPAGENAMEE}}}}}/doc |
|||
| action=history |
|||
}} history])</small> <br/> |
|||
| {{#ifeq: {{NAMESPACE}} | {{ns:Module}} |
|||
| You might want to <!-- |
|||
-->[{{fullurl:<!-- |
|||
-->{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}}<!-- |
|||
- |
|||
-->| action=edit&preload=Template:Documentation/preload-module-doc&summary=<!-- |
|||
-->{{urlencode:Create /doc subpage for [[{{{page|{{FULLPAGENAMEE}}}}}]]}}<!-- |
|||
-->&editintro=Template:Documentation/editintro-doc |
|||
}} create documentation] for this [[w:help:lua|Scribunto module]]. |
|||
| |
|||
}} |
|||
}} |
|||
}} |
|||
}}<!-- |
|||
- |
|||
- Sandbox and testcases |
|||
- |
|||
-->Editors can experiment in this {{#switch: {{NAMESPACE}}|{{ns:Template}} = template|{{ns:Module}} = module |#default = page}}'s <!-- |
|||
--> {{#ifexist: {{#if: {{{sandbox|}}} | {{{sandbox}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox--> |
|||
}}/sandbox<!-- end if page --> |
|||
}}<!--End if sandbox --> |
|||
<!-- If sandbox exists --> |
|||
| [[{{#if: {{{sandbox|}}} | {{{sandbox}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox--> |
|||
}}/sandbox<!-- end if page --> |
|||
}}<!--End if sandbox -->|sandbox]] <!-- |
|||
--><small>([{{fullurl:<!-- |
|||
-->{{#if: {{{sandbox|}}} | {{{sandbox}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox--> |
|||
}}/sandbox<!-- end if page --> |
|||
}}<!--End if sandbox --> |action=edit}}<!-- end fullurl--> edit] | <!-- |
|||
-->[{{fullurl: Special:ComparePages<!-- |
|||
- First page |
|||
-->|page1={{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox--> |
|||
}}<!-- end if page --><!-- |
|||
- Second page |
|||
-->&page2={{#if: {{{sandbox|}}} | {{{sandbox}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox--> |
|||
}}/sandbox<!-- end if page --> |
|||
}}<!--End if sandbox -->}}<!-- end fullurl--> diff])</small> |
|||
| sandbox <small>(<!-- |
|||
-->[{{fullurl: {{#if: {{{sandbox|}}} | {{{sandbox}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox --> |
|||
}}/sandbox<!-- end if page --> |
|||
}}<!--End if sandbox -->|action=edit&preload=Template:Documentation/preload-sandbox&summary=<!-- |
|||
-->{{urlencode:Create sandbox version of <!-- |
|||
-->[[{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}} }}}]] |
|||
}}<!-- end url encode --> |
|||
}}<!-- end fullurl --> create] | [{{fullurl: {{#if: {{{sandbox|}}} | {{{sandbox}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox --> |
|||
}}/sandbox<!-- end if page --> |
|||
}}<!--End if sandbox --> |
|||
|action=edit&preload=<!-- |
|||
-->{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}}}}<!-- |
|||
-->&summary=<!-- |
|||
-->{{urlencode:Create sandbox version of <!-- |
|||
-->[[{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}}}}]]<!-- |
|||
-->}}<!-- end url encode --><!-- |
|||
-->}}<!-- end fullurl --> mirror])</small> |
|||
}}<!-- |
|||
--> and <!-- |
|||
-->{{#ifexist: {{#if: {{{testcases|}}} | {{{testcases}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox --> |
|||
}}/testcases<!-- end if page --> |
|||
}}<!--End if testcases --> |
|||
| [[{{#if: {{{testcases|}}} | {{{testcases}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox --> |
|||
}}/testcases<!-- end if page --> |
|||
}}<!--End if testcases -->|testcases]]<!-- |
|||
--> <small>([{{fullurl: {{#if: {{{testcases|}}} | {{{testcases}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox --> |
|||
}}/testcases<!-- end if page --> |
|||
}}<!--End if testcases -->|action=edit}}<!-- end fullurl --> edit])</small> |
|||
| testcases ([{{fullurl: {{#if: {{{testcases|}}} | {{{testcases}}} |
|||
| {{#if: {{{page|}}} |
|||
| {{{page}}} |
|||
| {{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}}<!-- end ifeq subpagename = sandbox --> |
|||
}}/testcases<!-- end if page --> |
|||
}}<!--End if testcases -->|action=edit&preload=Template:Documentation/preload-testcases&summary=<!-- |
|||
-->{{urlencode:Create testcases for template <!-- |
|||
-->[[{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox |
|||
| {{NAMESPACE}}:{{BASEPAGENAMEE}} |
|||
| {{FULLPAGENAMEE}} |
|||
}} }}}]] |
|||
}}<!-- end url encode --> |
|||
}}<!-- end fullurl --> create])</small> |
|||
}} pages.<br/><!-- |
|||
- |
|||
- Category / Subpages text |
|||
- |
|||
-->{{#if: {{{content|{{{1|}}}}}} |
|||
| <!-- No text; we don't know where to put the category (in the {1}? inline?)--> |
|||
| {{#ifexist: {{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}/doc |
|||
| Add [[w:Help:Category|categories]] and [[w:Help:Interwiki link|interwikis]] to the <!-- |
|||
-->[[{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}/doc|/doc]]<!-- |
|||
--> subpage. |
|||
| |
|||
}} |
|||
}} [[Special:PrefixIndex/{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}}}}|Subpages of {{#ifeq: {{SUBPAGENAME}} | sandbox | the base | this }} {{#switch: {{NAMESPACE}}|{{ns:Module}} = module |{{ns:Template}} = template |#default = page }}]].<!-- |
|||
-->}}<!-- end if footer |
|||
--></div>}} |
|||
<!-- |
|||
end if footer = none --></div> |
Revision as of 20:25, 23 August 2022
- Description
- This template is used to insert documentation on template pages.
- Syntax
- Type
<noinclude>
at the end of the template page.{{Documentation}}
</noinclude>
General usage
On the Template page
Template code<noinclude> {{Documentation}} </noinclude>
On the Template/doc page
; Description : This template is used to do something. ; Dependencies: :* Uses (some CSS, JS, file, or other template). ; Syntax : Type <code>{{T|Templatename}}</code> somewhere. ; Sample output : <code><nowiki>{{Templatename|foo}}</nowiki></code> gives... : {{Templatename|foo}} <includeonly>Any categories for the template itself </includeonly><noinclude> [[Category:Template documentation]] </noinclude>
Use any or all of the above description/syntax/sample output sections. You may also want to add "see also" or further usage information sections.
Note that the above example also uses {{T}}
.
Dependencies
- Templates
- Template:Tocright (Template:Tocright/doc)
TemplateData
This template is used to display documentation on template pages. It also adds some tools to help the editor to modify the /doc subpage and the template.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Custom Documentation Location | 1 | The name of the custom /doc subpage.
| String | optional |
Inline Documentation Content | content | Content if documentation page will not be transcluded
| String | optional |
Custom Sandbox Location | sandbox | Specifies the /sandbox subpage location
| String | optional |
Heading text | heading | Changes the default "Documentation" header to a different one
| String | optional |
Custom footer content | footer | Replaces the default link box with a custom one
| Unbalanced wikitext | optional |
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories and interwikis to the /doc subpage. Subpages of this template.