Module:Infobox/doc: Difference between revisions
(Added technology_parsing) |
(Added crafting methods) |
||
Line 1: | Line 1: | ||
Lua methods used by [[Template:Infobox]]. | Lua methods used by [[Template:Infobox]]. | ||
== | == Methods == | ||
=== technology_parsing === | === technology_parsing === | ||
Line 15: | Line 15: | ||
=== item_parsing === | === item_parsing === | ||
Takes one argument in the form of a string. The string is expected to have the following format: | Takes one argument in the form of a string. The string is expected to have the following format: | ||
<pre>Iron plate, | <pre>Item, count + Iron plate, 45 + Iron ore + Electronic circuit, 5</pre> | ||
This string is split so that each entry between a <code>+</code> is forwarded to [[Template:Icon/special]] so that it displays the item and has the number as the caption. | This string is split so that each entry between a <code>+</code> is forwarded to [[Template:Icon/special]] so that it displays the item and has the number as the caption. The number (<code>, N</code>) is optional and defaults to nothing. | ||
=== crafting_parsing === | |||
Takes one argument in the form of a string. The string is expected to have the following format: | |||
<pre>Item ingredient, count + Iron ore, 45 + Electronic circuit, 5 = Item product, count + Advanced circuit, 4</pre> | |||
The text in front of the equals sign are treated as the recipe ingredients, the text behind the equals sign is treated as the recipe products. The products are optional and default to the name of the current page. For both ingredients and products, the count (<code>, N</code>) is optional and defaults to 1. | |||
This string is split so that each entry between a <code>+</code> is forwarded to [[Template:Icon/special]] so that it displays the item and has the count as the caption. | |||
=== crafting_raw === | |||
Takes one argument in the form of a string. The string is expected to have the following format: | |||
<pre>Item ingredient, count + Iron ore, 45 + Electronic circuit, 5</pre> | |||
The text in front of the equals sign are treated as the recipe ingredients, the text behind the equals sign is treated as the recipe products. If this is given the format from "crafting_parsing", then the products are ignored. For the ingredients the count (<code>, N</code>) is optional and defaults to 1. | |||
This string is split so that each entry between a <code>+</code> is forwarded to [[Template:Icon/special]] so that it displays the item and has the count as the caption. | |||
<noinclude>[[Category:Template documentation]]</noinclude> | <noinclude>[[Category:Template documentation]]</noinclude> |
Revision as of 10:30, 3 October 2024
Lua methods used by Template:Infobox.
Methods
technology_parsing
Takes one argument in the form of a string and one named argument, "color". The string is expected to have the following format:
Military 4 + Advanced oil processing + Advanced electronics 2, 2
This string is split so that each entry between a +
is forwarded to Template:Icon/special so that it displays the technology and has the level as the caption.
Before forwarding the arguments to the icon template, " (research)" is appended to the technology if a page with that name exists. Furthermore, the technology level is deduced from the technology name if it is not manually specified.
The color defaults to "999".
item_parsing
Takes one argument in the form of a string. The string is expected to have the following format:
Item, count + Iron plate, 45 + Iron ore + Electronic circuit, 5
This string is split so that each entry between a +
is forwarded to Template:Icon/special so that it displays the item and has the number as the caption. The number (, N
) is optional and defaults to nothing.
crafting_parsing
Takes one argument in the form of a string. The string is expected to have the following format:
Item ingredient, count + Iron ore, 45 + Electronic circuit, 5 = Item product, count + Advanced circuit, 4
The text in front of the equals sign are treated as the recipe ingredients, the text behind the equals sign is treated as the recipe products. The products are optional and default to the name of the current page. For both ingredients and products, the count (, N
) is optional and defaults to 1.
This string is split so that each entry between a +
is forwarded to Template:Icon/special so that it displays the item and has the count as the caption.
crafting_raw
Takes one argument in the form of a string. The string is expected to have the following format:
Item ingredient, count + Iron ore, 45 + Electronic circuit, 5
The text in front of the equals sign are treated as the recipe ingredients, the text behind the equals sign is treated as the recipe products. If this is given the format from "crafting_parsing", then the products are ignored. For the ingredients the count (, N
) is optional and defaults to 1.
This string is split so that each entry between a +
is forwarded to Template:Icon/special so that it displays the item and has the count as the caption.