Difference between revisions of "User:Philmasterplus/TemplateSandbox"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
− | <includeonly> | + | <includeonly>{{{1|{{{error|Missing parameter '1' for Template:Data}}}}}}{{{2|{{{error|Missing parameter 'field' for Template:Data}}}}}} |
+ | {{#ifexist:{{{1}}} | ||
+ | |{{ | ||
+ | {{{1}}} | ||
+ | |format=#switch:{{{2}}} | ||
+ | |{{{3}}} | ||
+ | }} | ||
+ | |{{{error|Page '{{{1}}}' does not exist in Template:Data}}} | ||
+ | }}</includeonly> | ||
+ | <noinclude> | ||
+ | <templatedata> | ||
+ | { | ||
+ | "description": "Utility template that extracts a field from a specially formatted page.", | ||
+ | "params": { | ||
+ | "1": { | ||
+ | "label": "Page name", | ||
+ | "description": "Name of the source page to extract the data from. The source page is evaluated as a #switch-statement.", | ||
+ | "type": "wiki-page-name", | ||
+ | "required": true, | ||
+ | "example": "visit_url" | ||
+ | }, | ||
+ | "2": { | ||
+ | "label": "Field name", | ||
+ | "description": "Field name to extract from the source page.", | ||
+ | "type": "line", | ||
+ | "required": true, | ||
+ | "example": "function1.parameter1" | ||
+ | }, | ||
+ | "3": { | ||
+ | "label": "Default value", | ||
+ | "description": "Default value if the page does not contain the given field", | ||
+ | "type": "string", | ||
+ | "example": "no_name" | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | </templatedata> | ||
+ | |||
+ | This template is similar to [https://kol.coldfront.net/thekolwiki/index.php/Template:Data Template:Data] in the KoL Coldfront Wiki. | ||
+ | </noinclude> |
Revision as of 14:30, 18 December 2020
Utility template that extracts a field from a specially formatted page.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Page name | 1 | Name of the source page to extract the data from. The source page is evaluated as a #switch-statement.
| Page | required |
Field name | 2 | Field name to extract from the source page.
| Line | required |
Default value | 3 | Default value if the page does not contain the given field
| String | optional |
This template is similar to Template:Data in the KoL Coldfront Wiki.