Template:Documentation: Difference between revisions
no edit summary
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
<!-- | |||
--> | - Documentation template | ||
-->{{# | - A template used to show the contents of a documentation subpage | ||
- Note: Comments (<!-- --.>) are often used to avoid unnecessary line breaks or spaces. | |||
--> | |||
<!-- | |||
- Pre-defined variables | |||
--><!-- | |||
-->{{#vardefine: base page | | |||
{{{page| | |||
{{#ifeq: {{SUBPAGENAME}} | sandbox | |||
| {{NAMESPACE}}:{{BASEPAGENAME}} | |||
| {{FULLPAGENAME}} | |||
}} | |||
}}} | |||
}}<!-- | |||
<!-- | -->{{#vardefine: current page | {{FULLPAGENAME}}}}<!-- | ||
-->{{#vardefine: doc page | | |||
: | {{#if: {{{page|}}} | ||
| {{{page}}}/doc | |||
| {{#if: {{{1|}}} | |||
| {{{1}}} | |||
| {{#var: base page}}/doc | |||
}} | |||
}} | |||
}}<!-- | |||
-->{{#vardefine: namespace | | |||
{{{demospace|{{#ifeq: {{NAMESPACE}} | {{TALKSPACE}} | |||
| {{SUBJECTSPACE}} | |||
| {{NAMESPACE}} | |||
}}}}} | |||
}}<!-- | |||
-->{{#vardefine: preload | | |||
{{{preload|Template:Documentation/preload}}}&summary={{urlencode:Create /doc subpage for [[{{#var: base page}}]]}}&editintro=Template:Documentation/editintro-doc | |||
}}<!-- | |||
-->{{#vardefine: preload-sandbox | | |||
{{{preload-sandbox|Template:Documentation/preload-sandbox}}}&summary={{urlencode:Create sandbox subpage for experimenting on template [[{{#var: base page}}]]}} | |||
}}<!-- | |||
-->{{#vardefine: preload-testcases | | |||
{{{preload-testcases|Template:Documentation/preload}}}&summary={{urlencode:Create testcases for [[{{#var: base page}}]]}} | |||
}}<!-- | |||
-->{{#vardefine: sandbox | | |||
{{#if: {{{page|}}} | |||
| {{{page}}}/sandbox | |||
| {{{sandbox|{{#var: base page}}/sandbox}}} | |||
}} | |||
}}<!-- | |||
-->{{#vardefine: testcases | | |||
{{#if: {{{page|}}} | |||
| {{{page}}}/testcases | |||
| {{{testcases|{{#var: base page}}/testcases}}} | |||
}} | |||
}}<!-- | |||
-->{{#vardefine: page text | | |||
{{#switch: {{#var: namespace}} | |||
| {{ns:Template}} = template | |||
| {{ns:Module}} = module | |||
< | | #default = page | ||
}} | |||
}}<!-- | |||
-->{{#vardefine: doc image | | |||
{{#ifeq: {{{heading|a}}} | <!-- null --> | |||
| <!-- heading is specified but empty, don't show image --> | |||
| [[File:{{#if: {{{content|}}} | |||
| Documentation_icon | |||
| {{#ifexist: {{#var: doc page}} | |||
| Documentation_icon | |||
| No Documentation_icon | |||
}} | |||
}}.svg|70px|link=|alt=|class=nomobile]] | |||
}} | |||
}}<!-- | |||
- | |||
- Sandbox header | |||
- | |||
-->{{#ifeq: {{SUBPAGENAMEE}} | sandbox | |||
| <div class="article-table" | |||
style="padding: 1.5em; margin: auto; border: 1px solid #5556; border-bottom: 1px solid #5556; width:75%;"><!-- | |||
-->This is a template sandbox subpage for [[{{#var: base page}}]]. <!-- | |||
-->{{#ifexist: {{#var: testcases}} | |||
| See also the companion subpage for [[{{#var: testcases}}|the testcases]]. | |||
}}<!-- | |||
--></div> | |||
}}<!-- | |||
=== | --><div class="template-documentation" style="clear: both; border: 1px solid #5556; margin: 1em;"><!-- | ||
- | |||
- Documentation Header | |||
- | |||
--><div class="article-table" style="padding: 1em; margin: 0; border-bottom: 1px solid #5556;"><!-- | |||
--><span style="font-size:1.5em">{{#var: doc image }}'''{{{heading|{{ucfirst: {{#var: page text}} }} Documentation}}}'''</span><!-- | |||
- | |||
- Documentation page tools | |||
- | |||
--><span style="float: right">[{{#if: {{{content|}}} | |||
| <!---->[[Special:EditPage/{{#var: current page}}|edit]] | [[Special:Purge/{{#var: current page}}|purge]] | |||
| {{#ifexist: {{#var: doc page}} | |||
| <!-- | |||
-->[[{{#var: doc page}}|view]] | [[Special:EditPage/{{#var: doc page}}|edit]] | [[Special:PageHistory/{{#var: doc page}}|history]] | [[Special:Purge/{{#var: current page}}|purge]] | |||
| <!-- | |||
-->[{{fullurl:{{FULLPAGENAMEE:{{#var: doc page}}}}|action=edit&preload={{#var: preload}} }} create] | [[Special:Purge/{{#var: current page}}|purge]] | |||
}} | |||
}}]</span><!-- | |||
--></div><!-- | |||
- | |||
- Documentation blurb | |||
- | |||
--><div style="padding: 1em; padding-bottom: 0; margin: 0;"> | |||
< | {{#ifeq: {{{content|a}}} | {{{content}}} | <!-- do nothing --> | ||
== | | {{#ifexist: {{#var: doc page}} | ||
| {{<!---->{{#var:doc page}}}} | |||
| The [[w:Help:Template documentation|documentation]] for this {{#var: page text}} does not exist. Create it at [{{fullurl:{{FULLPAGENAMEE:{{#var: doc page}}}}|action=edit&preload={{#var: preload}} }} {{#var: doc page}}]. | |||
}} | |||
}}<!-- | |||
- | |||
-->{{{content|}}} | |||
</div><!-- | |||
- | |||
- End blurb | |||
== | - | ||
; | -->{{#if: {{{nofooter|}}} | | | ||
<div class="article-table" style="clear: both; padding: 0.5em; margin: 0; border-top: 1px solid #5556;"><!-- | |||
- | |||
- The above [documentation] is … | |||
- | |||
-->{{#if: {{{content|}}} | |||
| <!-- do not show --> | |||
| {{#ifexist: {{#var: doc page}} | |||
| {{#ifeq: {{SUBPAGENAME}} | sandbox | |||
| This is the sandbox subpage of [[{{#var: base page}}]]; | |||
| The above | |||
{{ | }} [[w:Help:Template documentation|documentation]] is [[mw:Help:Transclusion|transcluded]] from [[{{#var: doc page}}]]. <small>([[Special:EditPage/{{#var: doc page}}|edit]] | [[Special:PageHistory/{{#var: doc page}}|history]])</small><br/> | ||
| {{#ifeq: {{#var: namespace}} | {{ns:Module}} | |||
| You might want to [{{fullurl:{{FULLPAGENAMEE:{{#var: doc page}}}}|action=edit&preload={{#var: preload}} }} create documentation] for this [[w:Help:Lua|Scribuntu module]]. <br/> | |||
< | | [{{fullurl:{{FULLPAGENAMEE:{{#var: doc page}}}}|action=edit&preload={{#var: preload}} }} Create documentation] for this template. <br/> | ||
}} | |||
}} | |||
}}<!-- | |||
- | |||
< | - Sandbox and testcases. | ||
{ | - | ||
- NOTE: THIS WILL CREATE MANY (yes, MANY) REDLINKS (IF YOU DIDN'T MAKE THE /sandbox or /testcases PAGES). IF YOU DONT WANT THE LINKS, PLEASE REPLACE THE CODE BELOW WITH: | |||
< | |||
Editors can experiment in the page's [{{fullurl: {{#var: sandbox}}}} sandbox] and [{{fullurl: {{#var: testcases}}}} testcases] pages. | |||
> | |||
- | |||
--><!-- | |||
--><!-- CHANGE START --><!-- | |||
-->Editors can experiment in this {{#var: page text}}'s <!-- | |||
- | |||
-->{{#ifexist: {{#var: sandbox}} | |||
| [[{{#var: sandbox}}|sandbox]] <!-- | |||
--><small>(<!-- | |||
-->[[Special:EditPage/{{#var: sandbox}}|edit]] | <!-- | |||
-->[{{fullurl: Special:ComparePages | |||
| page1={{FULLPAGENAMEE:{{#var: base page}}}}&page2={{FULLPAGENAMEE:{{#var: current page}}}} | |||
}} diff]<!-- | |||
-->)</small> | |||
| sandbox <small>(<!-- | |||
-->[{{fullurl: {{FULLPAGENAMEE:{{#var: sandbox}}}} | |||
| action=edit&preload={{#var: preload-sandbox}} | |||
}} create] | [{{fullurl: {{FULLPAGENAMEE:{{#var: sandbox}}}} | |||
| action=edit&preload={{FULLPAGENAMEE:{{#var: base page}}}} | |||
}} mirror]<!-- | |||
-->)</small> | |||
}}<!-- | |||
--> and <!-- | |||
-->{{#ifexist: {{#var:testcases}} | |||
| [[{{#var:testcases}}|testcases]] <small>([[Special:EditPage/{{#var: testcases}}|edit]])</small> | |||
| testcases <small>(<!-- | |||
-->[{{fullurl: {{FULLPAGENAMEE:{{#var: testcases}}}} | |||
| action=edit&preload={{#var: preload-testcases}} | |||
}} create]<!-- | |||
-->)</small> | |||
}}<!-- | |||
--> pages.<br/><!-- | |||
--><!-- CHANGE END --><!-- | |||
- | |||
- Category addition text & subpages text. | |||
- | |||
-->{{#if: {{{content|{{{1|}}}}}} | |||
| <!-- Do NOT show cat text *if* documentation is inline or transcluded from a different page. --> | |||
| {{#ifexist: {{#var: doc page}} | |||
| Add [[w:Help:categories|categories]] and [[w:Help:interwiki links|interwikis]] to the [[{{#var: doc page}}|/doc]] subpage. | |||
}} | |||
}}<!-- | |||
- | |||
-->[[Special:PrefixIndex/{{#var: current page}}|Subpages of this {{#var: page text}}]]. | |||
</div> | |||
}} | |||
</div> | |||
} | |||
< | |||
: | |||
: | |||
< |