Template:Param2: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
Created page with "<includeonly>{{#if: {{{ag|}}}|<b>{{Lnkstart}}Data Types#Aggregate{{!}}{{{1}}} {{Lnkend}}</b>|<b>{{Lnkstart}}Data Types#{{{1}}}{{!}}{{{1}}}{{Lnkend}}</b>}} {{#if: {{{..."
 
No edit summary
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#if: {{{ag|}}}|<b>{{Lnkstart}}Data Types#Aggregate{{!}}{{{1}}}&nbsp;{{Lnkend}}</b>|<b>{{Lnkstart}}Data Types#{{{1}}}{{!}}{{{1}}}{{Lnkend}}</b>}}&nbsp;{{#if: {{{2|}}}|{{Pspan|{{{2}}}}}}}</includeonly>
<includeonly>{{
<noinclude>
  type|{{data|{{{name}}}|function{{{func}}}.param{{{param}}}.type}}}}{{
    #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.optional}}
    | <span style="text-decoration: underline dotted" title="This parameter is optional">?</span>
  }}{{
  #ifeq: {{{format}}} | signature || {{
    #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}}}
    |&nbsp;{{Pspan|{{data|{{{name}}}|function{{{func}}}.param{{{param}}}}}}}{{
      #if: {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.default}}
      |&nbsp;= {{data|{{{name}}}|function{{{func}}}.param{{{param}}}.default}}
    }}
  }}
}}</includeonly><noinclude>


This is almost identical to [[Template:Param]] except that this has no trailing whitespace.
<templatedata>
{
  "description": "Despite the similar name, this is completely different from [[Template:Param]].",
  "params": {
    "name": {
      "label": "Function page name",
      "description": "Name of a function page. '''This must be a data page.'''",
      "type": "wiki-page-name",
      "required": true
    },
    "func": {
      "label": "Overloaded function number",
      "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.",
      "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"
    }
  }
}
</templatedata>


Seriously, why put the whitespace there?
==Examples==
===Types and parameters===
<pre>
*"{{param2|name=visit_url|func=1|param=1}}"
*"{{param2|name=visit_url|func=2|param=1}}"
*"{{param2|name=visit_url|func=2|param=2}}"
*"{{param2|name=visit_url|func=2|param=3}}"
</pre>
 
*"{{param2|name=visit_url|func=1|param=1}}"
*"{{param2|name=visit_url|func=2|param=1}}"
*"{{param2|name=visit_url|func=2|param=2}}"
*"{{param2|name=visit_url|func=2|param=3}}"
 
===Types only===
<pre>
*"{{param2|name=visit_url|func=1|param=1|format=signature}}"
*"{{param2|name=visit_url|func=2|param=1|format=signature}}"
*"{{param2|name=visit_url|func=2|param=2|format=signature}}"
*"{{param2|name=visit_url|func=2|param=3|format=signature}}"
</pre>
 
*"{{param2|name=visit_url|func=1|param=1|format=signature}}"
*"{{param2|name=visit_url|func=2|param=1|format=signature}}"
*"{{param2|name=visit_url|func=2|param=2|format=signature}}"
*"{{param2|name=visit_url|func=2|param=3|format=signature}}"
 
[[Category:Basic Templates]]
</noinclude>
</noinclude>

Latest revision as of 14:13, 31 December 2020


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

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
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=visit_url|func=1|param=1}}"
*"{{param2|name=visit_url|func=2|param=1}}"
*"{{param2|name=visit_url|func=2|param=2}}"
*"{{param2|name=visit_url|func=2|param=3}}"

Types only

*"{{param2|name=visit_url|func=1|param=1|format=signature}}"
*"{{param2|name=visit_url|func=2|param=1|format=signature}}"
*"{{param2|name=visit_url|func=2|param=2|format=signature}}"
*"{{param2|name=visit_url|func=2|param=3|format=signature}}"