Template:Item/doc

This template packs structured data into a compact item, which can be passed as a parameter to another template. This allows to pass multiple structured items to that template, which can iterate over the items and extract data from them.

Usage
The structured data item contains all parameters (both numbered ones and named ones) passed to the Item template. For example,  creates an item with components Alice,,.

Multiple items will be passed to an example recipient template User:Petr Matas/sandbox/Pets like this:

The code of the called template User:Petr Matas/sandbox/Pets is:


 * The code of the 1st used template Show pet is:


 * The code of the 2nd used template Sum is:


 * For further explanations see #invoke:item, #invoke:math and the following chapter.

Get a component of an item
See Template:Component.

Format an item using a template
See Template:Format item.

Format each item using a template
In the recipient template, use: {{#invoke:Item|each|template=TransformationTemplate|Separator|Prefix|Suffix|...}} This transforms all items using a given template. is called for each item with the parameters that the item has been created with, plus any additional parameters passed to #invoke (see Format item for details). The transformed items are separated with  and surrounded with   and   (whitespace is not stripped from these three optional parameters).

The template User:Petr Matas/sandbox/Pets from the example produces the list of pets using the following code (note the use of newline as a  and * as a   to produce list items): {{#invoke:Item|each|template=Show pet| |*}}

Gather given parameter from all items
In the recipient template, use  to gather the given parameter from all items. will be called once and the gathered parameters (one parameter from each item) will be passed to it.

The template User:Petr Matas/sandbox/Pets from the example produces the total number of legs using.