Difference between revisions of "Template:Param2"

From Kolmafia
Jump to navigation Jump to search
Line 1: Line 1:
<includeonly>{{
+
<includeonly>{{type|{{data|{{{name}}}|function{{{func}}}.param{{{param}}}.type}}}}{{
  #if:{{{1|}}}
+
   #ifeq: {{{format}}} | signature || {{
  |{{type|{{{1}}}}}
+
    #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}}}
}}{{
+
    | {{Pspan|{{data|{{{name}}}|function{{{func}}}.param{{{param}}}}}}}{{
   #if:{{{1|}}}|{{#if:{{{2|}}}|&nbsp;}}
+
      #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.default}}
}}{{
+
      |&nbsp;= {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.default}}}}}}}}</includeonly><noinclude>
  #if:{{{2|}}}
 
  |{{Pspan|{{{2}}}}}
 
}}</includeonly><noinclude>
 
  
 
<templatedata>
 
<templatedata>
 
{
 
{
   "description": "This is similar to [[Template:Param]] except that this has no trailing whitespace and does not make types bold font.",
+
   "description": "Despite the similar name, this is completely different from [[Template:Param]].",
 
   "params": {
 
   "params": {
     "1": {
+
     "name": {
       "label": "Parameter data type",
+
       "label": "Function page name",
       "description": "Parameter data type",
+
       "description": "Name of a function page. '''This must be a data page.'''",
      "required": true,
+
       "type": "wiki-page-name",
       "type": "line",
+
       "required": true
       "example": "string, int, void, item, monster, skill"
 
 
     },
 
     },
     "2": {
+
     "func": {
       "label": "Parameter name",
+
      "label": "Overloaded function number",
       "description": "Parameter name",
+
      "description": "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.",
       "required": true,
+
      "type": "number",
 +
      "required": true
 +
    },
 +
    "param": {
 +
       "label": "Parameter number",
 +
       "description": "Specify which parameter to extract. Allowed values are 1-5, inclusive.",
 +
      "type": "number",
 +
       "required": true
 +
    },
 +
    "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).",
 
       "type": "line"
 
       "type": "line"
 
     }
 
     }
Line 33: Line 40:
 
===Types and parameters===
 
===Types and parameters===
 
<pre>
 
<pre>
*{{param2|int|param1}}
+
*{{param2|name=User:Philmasterplus/Sandbox|func=1|param=1}}
*{{param2|float|param2}}
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=1}}
*{{param2|string [int]|param3}}
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=2}}
 +
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=3}}
 
</pre>
 
</pre>
  
*{{param2|int|param1}}
+
*
*{{param2|float|param2}}
+
*{{param2|name=User:Philmasterplus/Sandbox|func=1|param=1}}
*{{param2|string [int]|param3}}
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=1}}
 +
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=2}}
 +
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=3}}
  
 
===Types only===
 
===Types only===
 
<pre>
 
<pre>
*"{{param2|void}}"
+
*{{param2|name=User:Philmasterplus/Sandbox|func=1|param=1|format=signature}}
*"{{param2|monster}}"
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=1|format=signature}}
*"{{param2|boolean}}"
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=2|format=signature}}
 +
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=3|format=signature}}
 
</pre>
 
</pre>
  
*"{{param2|void}}"
+
*{{param2|name=User:Philmasterplus/Sandbox|func=1|param=1|format=signature}}
*"{{param2|monster}}"
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=1|format=signature}}
*"{{param2|boolean}}"
+
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=2|format=signature}}
 +
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=3|format=signature}}
 
</noinclude>
 
</noinclude>

Revision as of 22:42, 18 December 2020


Despite the similar name, this is completely different from [[Template:Param]].

Template parameters

ParameterDescriptionTypeStatus
Function page namename

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

Pagerequired
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
Parameter numberparam

Specify which parameter to extract. 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

Examples

Types and parameters

*{{param2|name=User:Philmasterplus/Sandbox|func=1|param=1}}
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=1}}
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=2}}
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=3}}
  • 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.

Types only

*{{param2|name=User:Philmasterplus/Sandbox|func=1|param=1|format=signature}}
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=1|format=signature}}
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=2|format=signature}}
*{{param2|name=User:Philmasterplus/Sandbox|func=2|param=3|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.