This is a mirror host of the KP Official Wiki on Miraheze. We dont actually mirror we host the same content

Template:Documentation: Difference between revisions

From Kaiju Paradise Official Wiki
miraheze-user->FANDOM
Draft subpages are deprecated with UCP. Default is "/sandbox".
 
miraheze-user->Aeywoo
Updated documentation template from and older version of the Documentation (copy) on the Fandom Templates Wiki.
 
Line 1: Line 1:
<includeonly>{| class="article-table plainlinks" style="width:100%;" role="complementary"
<!--
|- style="font-size:18px;"
- Documentation template
! style="padding:0px;" | <div style="width:100%; padding:3px 0px; text-align:center;" class="color1">Template documentation</div>
- A template used to show the contents of a documentation subpage
|-
- 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
| View or edit [[{{{1|Template:{{PAGENAMEE}}/doc}}}|this documentation]]. ([[Template:Documentation|About template documentation]])
- THIS TEMPLATE IS COMPLEX!!!
|-
-
| Editors can experiment in this template's [{{fullurl:{{FULLPAGENAMEE}}/sandbox|action=edit}} sandbox] and [{{fullurl:{{FULLPAGENAMEE}}/testcases}} test case] pages.
- EDIT AT YOUR OWN DISCRETION!!!
|}
--------------------------------------------
<div style="margin:0 1em;">
--><!--
{{{{{1|{{PAGENAME}}/doc}}}}}</div></includeonly><noinclude>{{Documentation}}[[Category:Documentation templates]]</noinclude>
- Sandbox notice
- Only shows if the subpage is a sandbox
-->
{{#ifeq: {{SUBPAGENAME}} | 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:Template-badinfo.svg|left|70px|link=|alt=]]
</div>
<div>
: This is a template sandbox subpage for [[{{NAMESPACE}}:{{BASEPAGENAME}}]].
:{{#ifexist: {{{testcases|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAME}}|{{FULLPAGENAME}}}}}}}/testcases}}}
  | See also the companion subpage for [[{{NAMESPACE}}:{{BASEPAGENAME}}/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}}:{{BASEPAGENAME}}|{{FULLPAGENAME}}}}}}}/doc}}}
            | Template-info
            | Template-noinfo
            }}
          }}.svg|left|70px|link=|alt=|class=mobile-hidden]]
    }}
  }}<!--
  - Heading
  --><span>'''{{#if: {{{heading|}}} | {{{heading|Documentation}}} | <!--
    -->{{#switch: {{SUBJECTSPACE}}
        | {{ns:Module}} = Module&nbsp;Documentation
        | {{ns:Template}} = Template&nbsp;Documentation
        | {{ns:File}} = Summary
        | #default = Documentation
        }}<!--
  -->}} <span class="mobileonly">follows<br/></span>'''</span><!--
    -
    - Tools section
    -
    -->{{#if: {{{heading}}} |<span style="float:right">&#x5B;<!--
  -->{{#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]]<!--
        --> &#x7C; <!--
        -->[{{fullurl:{{{1|{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAMEE}}|{{FULLPAGENAMEE}}}}/doc}}}}}}
              | action=edit
              }} edit]<!--
        --> &#x7C; [{{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--><!--
    --> &#x7C; [{{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}}:{{BASEPAGENAME}}
      | {{FULLPAGENAME}}
      }}
    }}/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]<!--
        --> &#x7C; [{{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]<!--
        --> &#x7C; [{{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
-
-->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] &#x7C; <!--
      -->[{{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] &#x7C; [{{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>
}}<!--
 
--> page.<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}}:{{BASEPAGENAME}}|{{FULLPAGENAME}}}}}}}/doc
    | Add [[w:Help:Category|categories]] and [[w:Help:Interwiki link|interwikis]] to the <!--
    -->[[{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAME}}|{{FULLPAGENAME}}}}}}}/doc|/doc]]<!--
    --> subpage.
    |
    }}
  }} [[Special:PrefixIndex/{{{page|{{#ifeq: {{SUBPAGENAME}}|sandbox|{{NAMESPACE}}:{{BASEPAGENAME}}|{{FULLPAGENAME}}}}}}}|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>

Latest revision as of 05:55, 21 January 2024

File:Template-info.svg
Template Documentation follows
[view | edit | history | purge]
Description
This template is used to insert documentation on template pages.
Syntax
Type <noinclude>{{Documentation}}</noinclude> at the end of the template page.

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:Documentation/preload
Template:Documentation/preload-sandbox
Template:Documentation/preload-testcases
Template:Tocright (Template:Tocright/doc)

TemplateData

<templatedata> { "params": { "1": { "description": "The name of the custom /doc subpage.", "example": "Template:Documentation/doc", "default": "Template:Documentation/doc", "label": "Custom Documentation Location", "type": "string" }, "content": { "description": "Content if documentation page will not be transcluded", "example": "This template creates quotes.", "label": "Inline Documentation Content", "type": "string" }, "sandbox": { "label": "Custom Sandbox Location", "description": "Specifies the /sandbox subpage location", "example": "Template:Example/sandbox", "type": "string", "default": "Template:Documentation/sandbox" }, "testcases": { "label": "Custom Testcases Location", "description": "Specifies the /testcases subpage location", "example": "Template:Example/testcases", "type": "string", "default": "Template:Documentation/testcases" },

       "heading": {

"label": "Heading text", "description": "Changes the default \"Documentation\" header to a different one", "example": "About this template", "type": "string" }, "footer": { "label": "Custom footer content", "description": "Replaces the default link box with a custom one", "example": "Documentation is automatically generated by {{Ambox}}.
Its contents are shown here.", "type": "unbalanced-wikitext" } }, "description": "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." } </templatedata>

The above documentation is transcluded from Template:Documentation/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) page.
Add categories and interwikis to the /doc subpage. Subpages of this template.