Difference between revisions of "Template:PropVals"
From Salem Wiki
m (adding code) |
m (Changed protection level for "Template:PropVals": images get protected also, so no cascade :/ ([edit=sysop] (indefinite) [move=sysop] (indefinite))) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<onlyinclude><!-- | <onlyinclude><!-- | ||
--><ul><!-- | --><ul><!-- | ||
− | + | -->{{#if: {{{debug|}}} | |
− | + | | {{#arraymap: | |
− | + | {{PropVals/getGroupedRecords | |
− | + | |prop={{{prop|RequiresObj}}} | |
− | + | |page={{{page|{{FULLPAGENAME}} }}} | |
− | + | |sep={{{sep|;}}} | |
− | + | |grpsep={{{grpsep|/\}}} | |
− | + | }} | |
− | + | | {{{grpsep|/\}}} | |
− | + | | xXx | |
− | + | | <li><nowiki>{{</nowiki>PropVals/List{{!}}sep<nowiki>=</nowiki>{{{sep|;}}}{{!}}showamount<nowiki>=</nowiki>{{{showamount|no}}}{{!}}xXx<nowiki>}}</nowiki><ul>{{PropVals/List|sep={{{sep|;}}}|showamount={{{showamount|no}}}|xXx}}</ul></li> | |
− | + | | | |
− | + | }} | |
− | + | | {{#arraymap: | |
− | + | {{PropVals/getGroupedRecords | |
− | + | |prop={{{prop|RequiresObj}}} | |
− | + | |page={{{page|{{FULLPAGENAME}} }}} | |
− | + | |sep={{{sep|;}}} | |
− | + | |grpsep={{{grpsep|/\}}} | |
− | + | }} | |
− | + | | {{{grpsep|/\}}} | |
− | + | | xXx | |
− | + | | {{PropVals/List|sep={{{sep|;}}}|showamount={{{showamount|no}}}|xXx}} | |
− | + | | | |
+ | }} | ||
+ | }}<!-- | ||
--></ul><!-- | --></ul><!-- | ||
--></onlyinclude><noinclude>{{documentation}}</noinclude> | --></onlyinclude><noinclude>{{documentation}}</noinclude> |
Latest revision as of 18:09, 25 July 2012
Template documentation (for the template shown above, sometimes hidden or invisible)
Description
- This is the main-entry-point of a complex template-class
- It is used to automatically list all the values of a property of a page as an un-ordered list.
- This generated-output will be used in {{Infobox}} to automatically show relevant info.
- See these pages for documentation on functions used:
- Other pages with relevant info are:
Functional logic
- {{PropVals}} is used as a wrapper to inject extra arguments into {{PropVals/List}}, using the output of {{PropVals/getGroupedRecords}}.
- {{PropVals/List}} is used as a wrapper to inject extra arguments into {{PropVals/Print Entry}}, to output each entry of a grouped-record under a common group-heading when appropriate, as list-items
<li>...</li>
.- {{PropVals/Print Entry}} is used to display each entry in a visually appealing way, by outputting an icon-image followed by a link to the page of the object followed by the amount when requested.
- It uses {{PropVals/Split}} to extract the name- and amount-fields from the entry.
- {{PropVals/Print Entry}} is used to display each entry in a visually appealing way, by outputting an icon-image followed by a link to the page of the object followed by the amount when requested.
- {{PropVals/getGroupedRecords}} is used as a wrapper to inject extra arguments into {{PropVals/Group}}, using the output of {{PropVals/getRecords}} as input, to output grouped-records, for further processing by {{PropVals}}.
- {{PropVals/Group}} is used as a wrapper to inject extra arguments into {{PropVals/Group/NextPart}}, using records as input, to output grouped-records.
- {{PropVals/Group/NextPart}} is used as a helper-template, to output a grouped-record that starts with the group-heading followed by entries.
- An entry is a record with its heading-field removed, that has the same heading-field as the previous record.
- It uses {{PropVals/Group/heading}} and {{PropVals/Split}} to separate the fields in the record.
- The structure of a record is:
Objectname{{{sep}}}Amount{{{sep}}}Groupheading
- {{PropVals/Group/NextPart}} is used as a helper-template, to output a grouped-record that starts with the group-heading followed by entries.
- {{PropVals/getRecords}} is used to retrieve all the values of a property of a page, and output them as records for further processing by {{PropVals/getGroupedRecords}}.
- {{PropVals/Group}} is used as a wrapper to inject extra arguments into {{PropVals/Group/NextPart}}, using records as input, to output grouped-records.
- {{PropVals/List}} is used as a wrapper to inject extra arguments into {{PropVals/Print Entry}}, to output each entry of a grouped-record under a common group-heading when appropriate, as list-items
Syntax
- Type the below code somewhere inside {{Infobox}} or a page:
{{PropVals |prop=RequiresObj |page={{FULLPAGENAME}} |sep={{{sep|;}}} |grpsep={{{grpsep|/\}}} |showamount={{{showamount|no}}} }}
Examples
- {{PropVals|prop=RequiresObj|page=Help:Infobox/testdata|showamount=y}} gives:
- {{PropVals|prop=RequiresObj|page=Help:Infobox/testdata|showamount=y|debug=y}} gives:
Sub-templates
- Test data used in examples: PropVals testdata
- {{PropVals/Group}}
- {{PropVals/Group/NextPart}}
- {{PropVals/Group/heading}}
- {{PropVals/List}}
- {{PropVals/Print Entry}}
- {{PropVals/Split}}
- {{PropVals/getGroupedRecords}}
- {{PropVals/getRecords}}
- {{PropVals/getIcon}}
Visit Template:PropVals/doc to edit this text! (How does this work?)