|
|
Line 94: |
Line 94: |
| "see_also": { | | "see_also": { |
| "label": "See Also section", | | "label": "See Also section", |
| "description": "If provided, this is used as the content for the See Also section", | | "description": "If provided, this is used as the content for the See Also section. Use [[Template:SeeAlso]] to build a See Also section.", |
| "type": "content" | | "type": "content" |
| }, | | }, |
Line 121: |
Line 121: |
| </templatedata> | | </templatedata> |
|
| |
|
| ==Examples== | | ==Notes== |
| <pre>{{User:Philmasterplus/TemplateSandbox2
| | This template is not meant to be used directly, but rather through the <code>{{{format|User:Philmasterplus/TemplateSandbox2}}}</code> section of a data-driven function page. |
| |name=User:Philmasterplus/Sandbox
| |
| |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.
| |
| |description=
| |
| <p>Returns the HTML from the visited page (not just what is displayed when visiting the page, but all markup) by performing a POST request if {{pspan|use_POST}} is omitted or true, or a GET request if false. Note that for addresses inside of KoL, it is only necessary to supply the page name for {{pspan|page}}, and KoLmafia will populate the rest of the url. However, pages outside of KoL require the full url to be supplied for {{pspan|page}}.</p>
| |
| | |
| <p>The version with no parameters is only meaningful in a relay override script; it retrieves the server page that your script is overriding. All four versions behave slightly differently in a relay script; they retrieve a version of the page with any KoLmafia decorations added, rather than the raw page from the server.</p>
| |
| | |
| <p>In a POST request, if &pwd is part of the {{pspan|page}} string, it will automatically be replaced by &pwd=###### where ###### is the password hash for the current session. For a GET request the password hash will not be added so you'll want to use {{f|my_hash}}.</p>
| |
| }}</pre>
| |
| | |
| {{User:Philmasterplus/TemplateSandbox2
| |
| |name=User:Philmasterplus/Sandbox
| |
| |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.
| |
| |description=
| |
| <p>Returns the HTML from the visited page (not just what is displayed when visiting the page, but all markup) by performing a POST request if {{pspan|use_POST}} is omitted or true, or a GET request if false. Note that for addresses inside of KoL, it is only necessary to supply the page name for {{pspan|page}}, and KoLmafia will populate the rest of the url. However, pages outside of KoL require the full url to be supplied for {{pspan|page}}.</p>
| |
| | |
| <p>The version with no parameters is only meaningful in a relay override script; it retrieves the server page that your script is overriding. All four versions behave slightly differently in a relay script; they retrieve a version of the page with any KoLmafia decorations added, rather than the raw page from the server.</p>
| |
| | |
| <p>In a POST request, if &pwd is part of the {{pspan|page}} string, it will automatically be replaced by &pwd=###### where ###### is the password hash for the current session. For a GET request the password hash will not be added so you'll want to use {{f|my_hash}}.</p>
| |
| }}
| |
| </noinclude> | | </noinclude> |
Template parameters[Edit template data]
Parameter | Description | Type | Status |
---|
ASH function name | name | Name of the ASH function. This should match the function page name. - Example
- visit_url
| Line | required |
---|
Description | description | Long description that covers all functions. Note: Use <p></p> to separate paragraphs, because double line breaks don't work
| Content | required |
---|
Function 1, description | function1.description | Short description for the overloaded function 1 (and so on for functions 2 through 3) - Example
- Visits a web page and returns its HTML source.
| Content | required |
---|
Function 1, return type | function1.return_type | Return type of the overloaded function 1. - Example
- buffer
| 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). - Example
- url
| Line | optional |
---|
Function 1, parameter 1 description | function1.param1.description | Description of parameter 1 of the overloaded function 1. - Example
- URL of the page to visit. If a relative URL is provided, it is treated as an in-game page.
| 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. - Example
- yes
| Line | optional |
---|
Function 1, parameter 1 default value | function1.param1.default | If this is specified, function1.param1.optional must be "yes" - Example
- ""
| Line | optional |
---|
Example code 1 | code1 | Example code showing how to use this function. Use [[Template:CodeSample]] to create sample code. (Same for code2 through code5)
| Content | optional |
---|
Equivalent gCLI command | cli_equiv | If provided, must be a gCLI command that provides functionality equivalent to this function.
| Line | optional |
---|
See Also section | see_also | If provided, this is used as the content for the See Also section. Use [[Template:SeeAlso]] to build a See Also section.
| Content | optional |
---|
More Information section | more_info | If provided, this is used as the content for the More Information section
| Content | optional |
---|
Special section | special | If provided, this is used as the content for the Special section
| Content | optional |
---|
Needs code samples? | needscode | If set to "yes", adds a "needs code samples" banner and categorizes the page under [[Category:Needs Code Sample]].
| Line | optional |
---|
Needs improved code samples? | improvecode | If set to "yes", adds a "needs better code samples" banner and categorizes the page under [[Category:Needs Code Sample]].
| Line | optional |
---|
Notes
This template is not meant to be used directly, but rather through the User:Philmasterplus/TemplateSandbox2
section of a data-driven function page.