Template:FunctionDeclaration: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
No edit summary
No edit summary
Line 13: Line 13:
     |, {{param2|name={{{name}}}|func={{{func}}}|param=5|format={{{format}}}}}}}{{
     |, {{param2|name={{{name}}}|func={{{func}}}|param=5|format={{{format}}}}}}}{{
     #if: {{data|{{{name}}}|function{{{func}}}.param1.type}}
     #if: {{data|{{{name}}}|function{{{func}}}.param1.type}}
     |&nbsp;}})</b></kbd>
     |&nbsp;}})</b></kbd>{{
      #if: {{{desc|}}}
      | <br>{{data|{{{name}}}|function{{{func}}}.description}}{{
        #if: {{data|{{{name}}}|function{{{func}}}.param1.type}}
        | * {{pspan|{{data|{{{name}}}|function{{{func}}}.param1}}}}: {{data|{{{name}}}|function{{{func}}}.param1.description}}}}{{
        #if: {{data|{{{name}}}|function{{{func}}}.param2.type}}
        | * {{pspan|{{data|{{{name}}}|function{{{func}}}.param2}}}}: {{data|{{{name}}}|function{{{func}}}.param2.description}}}}{{
        #if: {{data|{{{name}}}|function{{{func}}}.param3.type}}
        | * {{pspan|{{data|{{{name}}}|function{{{func}}}.param3}}}}: {{data|{{{name}}}|function{{{func}}}.param3.description}}}}{{
        #if: {{data|{{{name}}}|function{{{func}}}.param4.type}}
        | * {{pspan|{{data|{{{name}}}|function{{{func}}}.param4}}}}: {{data|{{{name}}}|function{{{func}}}.param4.description}}}}{{
        #if: {{data|{{{name}}}|function{{{func}}}.param5.type}}
        | * {{pspan|{{data|{{{name}}}|function{{{func}}}.param5}}}}: {{data|{{{name}}}|function{{{func}}}.param5.description}}}}
    }}
   | {{error|Invalid function number (func &#61; "{{{func|}}}") in Template:FunctionDeclaration}}}}</includeonly><noinclude>
   | {{error|Invalid function number (func &#61; "{{{func|}}}") in Template:FunctionDeclaration}}}}</includeonly><noinclude>


Line 35: Line 48:
       "label": "Rendering format",
       "label": "Rendering format",
       "description": "\"\" (empty string) = show everything, \"signature\" = only show parameter types (i.e. function signature). Default value is empty string (show everything).",
       "description": "\"\" (empty string) = show everything, \"signature\" = only show parameter types (i.e. function signature). Default value is empty string (show everything).",
      "type": "line"
    },
    "desc": {
      "label": "Show descriptions?",
      "description": "If set to \"yes\", also show the description of each function and its parameters below the declaration. Technically, any non-empty string works, but please use \"yes\" for ease of maintenance.",
       "type": "line"
       "type": "line"
     }
     }
Line 42: Line 60:


==Examples==
==Examples==
===Normal===
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=1}}</pre>
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=1}}</pre>


Line 50: Line 69:
{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2}}
{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2}}


===Normal with Description===
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=1|desc=yes}}</pre>
{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=1|desc=yes}}
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|desc=yes}}</pre>
{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|desc=yes}}
===Signature===
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|format=signature}}</pre>
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|format=signature}}</pre>


{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|format=signature}}
{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|format=signature}}


===Invalid or missing function number===
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=4}}</pre>
<pre>{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=4}}</pre>



Revision as of 09:34, 20 December 2020


Displays an ASH function's declaration. This is meant to be transcluded by other templates, rather than regular pages.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Function page namename

Name of a function page. '''This must be a data page.'''

Page namerequired
Overloaded function numberfunc

A function page may describe multiple overloaded functions under the same name. This parameter allows you to select one. Allowed values are 1-5, inclusive.

Numberrequired
Rendering formatformat

"" (empty string) = show everything, "signature" = only show parameter types (i.e. function signature). Default value is empty string (show everything).

Lineoptional
Show descriptions?desc

If set to "yes", also show the description of each function and its parameters below the declaration. Technically, any non-empty string works, but please use "yes" for ease of maintenance.

Lineoptional

Examples

Normal

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=1}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )

Normal with Description

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=1|desc=yes}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )
Nothing to see here, move along.

  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|desc=yes}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )
Nothing to see here, move along.

  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.
  • Nothing to see here, move along.: Nothing to see here, move along.

Signature

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=2|format=signature}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.?, Nothing to see here, move along.?, Nothing to see here, move along.?, Nothing to see here, move along.?, Nothing to see here, move along.? )

Invalid or missing function number

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=4}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox|func=0}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )

{{FunctionDeclaration|name=User:Philmasterplus/Sandbox}}

Nothing to see here, move along. Nothing to see here, move along.( Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along., Nothing to see here, move along.? Nothing to see here, move along. = Nothing to see here, move along. )