Template:Function2: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 188: | Line 188: | ||
==Examples== | ==Examples== | ||
<pre>{{User:Philmasterplus/TemplateSandbox2 | |||
|name=visit_url | |||
|function1.return_type=buffer | |||
|function1.short_description=Returns the original HTML source of the page being overridden inside a relay override script. | |||
|function1.description=Returns the original HTML source of the page being overridden. ''This function works only inside a relay override script.'' | |||
|function2.return_type=buffer | |||
|function2.short_description=Visits a web page and returns its HTML source. | |||
|function2.description=Makes an HTTP request to a web page and returns its HTML source. | |||
|function2.param1=url | |||
|function2.param1.type=string | |||
|function2.param1.optional=yes | |||
|function2.param1.default="" | |||
|function2.param1.description=URL of the page to visit. If a relative URL is provided, it is treated as an in-game page. | |||
|function2.param2=use_POST | |||
|function2.param2.type=boolean | |||
|function2.param2.optional=yes | |||
|function2.param2.default=true | |||
|function2.param2.description=If <code>true</code>, makes an HTTP POST request when visiting the URL. Otherwise, makes a GET request. | |||
|function2.param3=encoded | |||
|function2.param3.type=boolean | |||
|function2.param3.optional=yes | |||
|function2.param3.default=false | |||
|function2.param3.description=If <code>true</code>, KoLmafia assumes that <code>url</code> has already been [[wikipedia:Percent-encoding|URL-encoded]] and will not encode it. | |||
}}</pre> | |||
{{User:Philmasterplus/TemplateSandbox2 | |||
|name=visit_url | |||
|function1.return_type=buffer | |||
|function1.short_description=Returns the original HTML source of the page being overridden inside a relay override script. | |||
|function1.description=Returns the original HTML source of the page being overridden. ''This function works only inside a relay override script.'' | |||
|function2.return_type=buffer | |||
|function2.short_description=Visits a web page and returns its HTML source. | |||
|function2.description=Makes an HTTP request to a web page and returns its HTML source. | |||
|function2.param1=url | |||
|function2.param1.type=string | |||
|function2.param1.optional=yes | |||
|function2.param1.default="" | |||
|function2.param1.description=URL of the page to visit. If a relative URL is provided, it is treated as an in-game page. | |||
|function2.param2=use_POST | |||
|function2.param2.type=boolean | |||
|function2.param2.optional=yes | |||
|function2.param2.default=true | |||
|function2.param2.description=If <code>true</code>, makes an HTTP POST request when visiting the URL. Otherwise, makes a GET request. | |||
|function2.param3=encoded | |||
|function2.param3.type=boolean | |||
|function2.param3.optional=yes | |||
|function2.param3.default=false | |||
|function2.param3.description=If <code>true</code>, KoLmafia assumes that <code>url</code> has already been [[wikipedia:Percent-encoding|URL-encoded]] and will not encode it. | |||
}} | |||
</noinclude> | </noinclude> |
Revision as of 17:42, 18 December 2020
Replacement for Template:FunctionPage. Must be used with function pages that follow a specific format.
Parameter | Description | Type | Status | |
---|---|---|---|---|
ASH function name | name | Name of the ASH function. This should match the function page name.
| Line | required |
Function 1, short description | function1.short_description | Short description for the overloaded function 1 (and so on for functions 2 through 3)
| Content | optional |
Function 1, return type | function1.return_type | Return type of the overloaded function 1.
| Line | required |
Function 1, parameter 1 | function1.param1 | Name of the parameter 1 of the overloaded function 1 (and so on for parameters 2 through 5).
| Line | optional |
Function 1, parameter 1 description | function1.param1.description | Description of parameter 1 of the overloaded function 1.
| Content | optional |
Function 1, parameter 1 is optional? | function1.param1.optional | "yes" = optional. Any non-empty string will do, but please use "yes" to make standardization easier.
| Line | optional |
Function 1, parameter 1 default value | function1.param1.default | If this is specified, function1.param1.optional must be "yes"
| Line | optional |
Examples
{{User:Philmasterplus/TemplateSandbox2 |name=visit_url |function1.return_type=buffer |function1.short_description=Returns the original HTML source of the page being overridden inside a relay override script. |function1.description=Returns the original HTML source of the page being overridden. ''This function works only inside a relay override script.'' |function2.return_type=buffer |function2.short_description=Visits a web page and returns its HTML source. |function2.description=Makes an HTTP request to a web page and returns its HTML source. |function2.param1=url |function2.param1.type=string |function2.param1.optional=yes |function2.param1.default="" |function2.param1.description=URL of the page to visit. If a relative URL is provided, it is treated as an in-game page. |function2.param2=use_POST |function2.param2.type=boolean |function2.param2.optional=yes |function2.param2.default=true |function2.param2.description=If <code>true</code>, makes an HTTP POST request when visiting the URL. Otherwise, makes a GET request. |function2.param3=encoded |function2.param3.type=boolean |function2.param3.optional=yes |function2.param3.default=false |function2.param3.description=If <code>true</code>, KoLmafia assumes that <code>url</code> has already been [[wikipedia:Percent-encoding|URL-encoded]] and will not encode it. }}
Function Syntax
{{#if: buffer
|buffer visit_url(
{{#if: buffer
|buffer visit_url(
{{#if:
|{{{function3.return_type}}} visit_url(