Difference between revisions of "Template:PropVals/doc"

From Salem Wiki
Jump to: navigation, search
m (→‎Sub-templates: adding the test data page, for reference)
m (Protected "Template:PropVals/doc": Documentation of key-feature ([edit=sysop] (indefinite) [move=sysop] (indefinite)))
 
(9 intermediate revisions by the same user not shown)
Line 17: Line 17:
 
*{{t|PropVals}} is used as a wrapper to inject extra arguments into {{t|PropVals/List}}, using the output of {{t|PropVals/getGroupedRecords}}.
 
*{{t|PropVals}} is used as a wrapper to inject extra arguments into {{t|PropVals/List}}, using the output of {{t|PropVals/getGroupedRecords}}.
 
*#{{t|PropVals/List}} is used as a wrapper to inject extra arguments into {{t|PropVals/Print Entry}}, to output each '''''entry''''' of a '''''grouped-record''''' under a common group-heading when appropriate, as list-items <code><nowiki><li>...</li></nowiki></code>.
 
*#{{t|PropVals/List}} is used as a wrapper to inject extra arguments into {{t|PropVals/Print Entry}}, to output each '''''entry''''' of a '''''grouped-record''''' under a common group-heading when appropriate, as list-items <code><nowiki><li>...</li></nowiki></code>.
*#*{{t|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.
+
*#*{{t|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 {{t|PropVals/Split}} to extract the name- and amount-fields from the '''''entry'''''.
 
*#*:It uses {{t|PropVals/Split}} to extract the name- and amount-fields from the '''''entry'''''.
*#*:<span style="color:purple;">The amount should not always be displayed, because not all properties have amounts...</span>
 
 
*#{{t|PropVals/getGroupedRecords}} is used as a wrapper to inject extra arguments into {{t|PropVals/Group}}, using the output of {{t|PropVals/getRecords}} as input, to output '''''grouped-records''''', for further processing by {{t|PropVals}}.
 
*#{{t|PropVals/getGroupedRecords}} is used as a wrapper to inject extra arguments into {{t|PropVals/Group}}, using the output of {{t|PropVals/getRecords}} as input, to output '''''grouped-records''''', for further processing by {{t|PropVals}}.
 
*##{{t|PropVals/Group}} is used as a wrapper to inject extra arguments into {{t|PropVals/Group/NextPart}}, using '''''records''''' as input, to output '''''grouped-records'''''.
 
*##{{t|PropVals/Group}} is used as a wrapper to inject extra arguments into {{t|PropVals/Group/NextPart}}, using '''''records''''' as input, to output '''''grouped-records'''''.
*##*{{t|PropVals/Group/NextPart}} is used as a helper-template, to output a '''''grouped-record''''' that starts with the ''group-heading'' followed by '''''entries''''', with their heading-field removed, that have the same heading-field as the previous '''''entry'''''.  
+
*##*{{t|PropVals/Group/NextPart}} is used as a helper-template, to output a '''''grouped-record''''' that starts with the ''group-heading'' followed by '''''entries'''''.
*##*:It uses {{t|PropVals/Split}} to separate the ''group-heading'' (heading-field), from the ''Objectname'' and ''Amount'' in the '''''record'''''.
+
*##*:An '''''entry''''' is a '''''record''''' with its heading-field removed, that has the same heading-field as the previous '''''record'''''.  
 +
*##*:It uses {{t|PropVals/Group/heading}} and {{t|PropVals/Split}} to separate the ''fields'' in the '''''record'''''.
 +
*##*:The structure of a '''''record''''' is: <code><nowiki>Objectname{{{sep}}}Amount{{{sep}}}Groupheading</nowiki></code>
 
*##{{t|PropVals/getRecords}} is used to retrieve all the values of a property of a page, and output them as '''''records''''' for further processing by {{t|PropVals/getGroupedRecords}}.
 
*##{{t|PropVals/getRecords}} is used to retrieve all the values of a property of a page, and output them as '''''records''''' for further processing by {{t|PropVals/getGroupedRecords}}.
 +
 
==Syntax==
 
==Syntax==
 
:Type the below code somewhere inside {{t|Infobox}} or a page:
 
:Type the below code somewhere inside {{t|Infobox}} or a page:
<pre>{{PropVals |prop=RequiresObj |page={{FULLPAGENAME}} |sep={{{sep|;}}} |grpsep={{{grpsep|/\}}} }}</pre>
+
<pre>{{PropVals |prop=RequiresObj |page={{FULLPAGENAME}} |sep={{{sep|;}}} |grpsep={{{grpsep|/\}}} |showamount={{{showamount|no}}} }}</pre>
 +
 
 
==Examples==
 
==Examples==
#{{t|PropVals|prop<nowiki>=</nowiki>RequiresObj|page<nowiki>=</nowiki>User:©TriMoon™/PropVals testdata}} gives:<br/>{{PropVals|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata}}
+
#{{t|PropVals|prop<nowiki>=</nowiki>RequiresObj|page<nowiki>=</nowiki>Help:Infobox/testdata|showamount<nowiki>=</nowiki>y}} gives:<br/>{{PropVals|prop=RequiresObj|page=Help:Infobox/testdata|showamount=y}}
#{{t|PropVals|prop<nowiki>=</nowiki>RequiresObj|page<nowiki>=</nowiki>User:©TriMoon™/PropVals testdata|debug<nowiki>=</nowiki>y}} gives:<br/>{{PropVals|prop=RequiresObj|page=User:©TriMoon™/PropVals testdata|debug=y}}
+
#{{t|PropVals|prop<nowiki>=</nowiki>RequiresObj|page<nowiki>=</nowiki>Help:Infobox/testdata|showamount<nowiki>=</nowiki>y|debug<nowiki>=</nowiki>y}} gives:<br/>{{PropVals|prop=RequiresObj|page=Help:Infobox/testdata|showamount=y|debug=y}}
  
 
==Sub-templates==
 
==Sub-templates==
*Test data used in examples: [[User:©TriMoon™/PropVals testdata|PropVals testdata]]
+
*Test data used in examples: [[Help:Infobox/testdata|PropVals testdata]]
 
*{{t|PropVals/Group}}
 
*{{t|PropVals/Group}}
 
*{{t|PropVals/Group/NextPart}}
 
*{{t|PropVals/Group/NextPart}}
Line 42: Line 45:
 
*{{t|PropVals/getGroupedRecords}}
 
*{{t|PropVals/getGroupedRecords}}
 
*{{t|PropVals/getRecords}}
 
*{{t|PropVals/getRecords}}
 +
*{{t|PropVals/getIcon}}
 
<includeonly>[[Category:Templates|{{PAGENAME}}]]<!-- Any categories for the template itself -->
 
<includeonly>[[Category:Templates|{{PAGENAME}}]]<!-- Any categories for the template itself -->
 
[[Category:Templates/©TriMoon™|{{SUBPAGENAME}}]]
 
[[Category:Templates/©TriMoon™|{{SUBPAGENAME}}]]
 
</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>
 
</includeonly><noinclude>[[Category:Template documentation|{{PAGENAME}}]]</noinclude>

Latest revision as of 18:14, 25 July 2012

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

Syntax

Type the below code somewhere inside {{Infobox}} or a page:
{{PropVals |prop=RequiresObj |page={{FULLPAGENAME}} |sep={{{sep|;}}} |grpsep={{{grpsep|/\}}} |showamount={{{showamount|no}}} }}

Examples

  1. {{PropVals|prop=RequiresObj|page=Help:Infobox/testdata|showamount=y}} gives:
    • {{PropVals|prop=RequiresObj|page=Help:Infobox/testdata|showamount=y|debug=y}} gives:

      Sub-templates