<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3AItem%2Fdoc</id>
	<title>Template:Item/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://safernicotine.wiki/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Template%3AItem%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Item/doc&amp;action=history"/>
	<updated>2026-04-03T17:51:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://safernicotine.wiki/mediawiki/index.php?title=Template:Item/doc&amp;diff=38421&amp;oldid=prev</id>
		<title>imported&gt;Vanisaac: /* See also */clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other</title>
		<link rel="alternate" type="text/html" href="https://safernicotine.wiki/mediawiki/index.php?title=Template:Item/doc&amp;diff=38421&amp;oldid=prev"/>
		<updated>2020-04-25T22:40:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;See also: &lt;/span&gt;clean up per &lt;a href=&quot;/mediawiki/index.php?title=WP:CAT&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:CAT (page does not exist)&quot;&gt;WP:CAT#T&lt;/a&gt; and &lt;a href=&quot;/mediawiki/index.php?title=WP:AWBREQ&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;WP:AWBREQ (page does not exist)&quot;&gt;WP:AWBREQ&lt;/a&gt; add template:Sandbox other&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
{{lua|Module:Item}}&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
The structured data item contains all parameters (both numbered ones and named ones) passed to the {{tl|Item}} template. For example, &amp;lt;code&amp;gt;{{tlp|Item|Alice|Bob|best{{=}}Eve}}&amp;lt;/code&amp;gt; creates an item with components {{code|1{{=}}Alice}}, {{code|2{{=}}Bob}}, {{code|best{{=}}Eve}}.&lt;br /&gt;
&lt;br /&gt;
Multiple items will be passed to an example recipient template {{tlu|User:Petr Matas/sandbox/Pets}} like this:&lt;br /&gt;
{{Automarkup|1=&lt;br /&gt;
{{((}}User:Petr Matas/sandbox/Pets{{!}}owner=Bob&lt;br /&gt;
{{!}} {{((}}Item{{!}}name=Tom{{!}}animal=cat{{!}}legs=4{{))}}&lt;br /&gt;
{{!}} {{((}}Item{{!}}name=Jerry{{!}}animal=mouse{{!}}legs=4{{))}}&lt;br /&gt;
{{!}} {{((}}Item{{!}}name=Tweety{{!}}animal=bird{{!}}legs=2{{))}}&lt;br /&gt;
{{))}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Constructs available to recipient templates ==&lt;br /&gt;
=== Get a component of an item ===&lt;br /&gt;
See [[Template:Component]].&lt;br /&gt;
&lt;br /&gt;
=== Format an item using a template ===&lt;br /&gt;
See [[Template:Format item]].&lt;br /&gt;
&lt;br /&gt;
=== Format each item using a template ===&lt;br /&gt;
In the recipient template, use:&lt;br /&gt;
 {{((}}#invoke:Item|each|template=&amp;#039;&amp;#039;TransformationTemplate&amp;#039;&amp;#039;|&amp;#039;&amp;#039;Separator&amp;#039;&amp;#039;|&amp;#039;&amp;#039;Prefix&amp;#039;&amp;#039;|&amp;#039;&amp;#039;Suffix&amp;#039;&amp;#039;|...}}&lt;br /&gt;
This transforms all items using a given template. &amp;lt;code&amp;gt;&amp;#039;&amp;#039;TransformationTemplate&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; is called for each item with the parameters that the item has been created with, plus any additional parameters passed to {{code|#invoke}} (see {{tl|Format item}} for details). The transformed items are separated with &amp;lt;code&amp;gt;&amp;#039;&amp;#039;Separator&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and surrounded with &amp;lt;code&amp;gt;&amp;#039;&amp;#039;Prefix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;#039;&amp;#039;Suffix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; (whitespace is not stripped from these three optional parameters).&lt;br /&gt;
&lt;br /&gt;
The template {{tlu|User:Petr Matas/sandbox/Pets}} from the example produces the list of pets using the following code (note the use of newline as a &amp;lt;code&amp;gt;&amp;#039;&amp;#039;Separator&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; and {{code|*}} as a &amp;lt;code&amp;gt;&amp;#039;&amp;#039;Prefix&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; to produce list items):&lt;br /&gt;
 {{((}}#invoke:Item|each|template=[[Template:Show pet|Show pet]]|&lt;br /&gt;
 |*}}&lt;br /&gt;
&lt;br /&gt;
=== Gather given parameter from all items ===&lt;br /&gt;
In the recipient template, use &amp;lt;code&amp;gt;{{((}}#invoke:Item|gather|parameter=&amp;#039;&amp;#039;ParameterName&amp;#039;&amp;#039;|template=&amp;#039;&amp;#039;TransformationTemplate&amp;#039;&amp;#039;}}&amp;lt;/code&amp;gt; to gather the given parameter from all items. &amp;lt;code&amp;gt;&amp;#039;&amp;#039;TransformationTemplate&amp;#039;&amp;#039;&amp;lt;/code&amp;gt; will be called &amp;#039;&amp;#039;once&amp;#039;&amp;#039; and the gathered parameters (one parameter from each item) will be passed to it.&lt;br /&gt;
&lt;br /&gt;
The template {{tlu|User:Petr Matas/sandbox/Pets}} from the example produces the total number of legs using &amp;lt;code&amp;gt;{{((}}#invoke:Item|gather|parameter=legs|template=[[Template:Sum|Sum]]}}&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|For loop}}&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
[[Category:Wikipedia formatting and function templates]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>imported&gt;Vanisaac</name></author>
	</entry>
</feed>