Template:ItemCard: Difference between revisions

Experimental quantity parameter
mNo edit summary
(Experimental quantity parameter)
Line 10:
|format=list
|no html
}} }}{{#vardefine:Icon | {{#explode:{{#var:itemdata}}|{{!}}|0}} }}{{#vardefine:Name | {{#explode:{{#var:itemdata}}|{{!}}|1}} }}{{#vardefine:Page | {{#explode:{{#var:itemdata}}|{{!}}|2}} }}{{#ifeq:{{{text|+}}}|{{{text|-}}} | {{#vardefine:DisplayName | {{{text|}}} }} | {{#vardefine:DisplayName | {{#var:Name}} }} }}{{#if: {{#var:block_output}} | <span style="display:inline-block;text-align:center;width:{{{2|32px}}}"> }}{{#if: {{{quantity|}}} | <span class="item-quantity">{{#ifexpr: {{{quantity|}}} < 10000 | {{{quantity|}}} | {{#expr: {{{quantity|}}}/1000 round 0 }}k }}</span> }}[[File:{{#var:Icon}}|{{{2|32px}}}|{{#if: {{#var:DisplayName}} | {{#var:DisplayName}} | {{#var:Name}} }}|link={{#var:Page}}|class=itemcard]]{{#if: {{#var:DisplayName}} | [[{{#var:Page}}|{{#var:DisplayName}}]] }}{{#if: {{#var:block_output}} | </span> }}{{#vardefine:block_output | }}{{#vardefine:Name | }}{{#vardefine:Icon | }}{{#vardefine:Page | }}{{#vardefine:DisplayName | }}</includeonly><noinclude>
Outputs an image of the item that links back to its page.
==Usage==
Line 17:
*<code>32px</code>: image size with statement format corresponding to MediaWiki File size style (''32px'' for set width, ''x32px'' for set height, ''32x32px'' for arbitrary scaling); should be a width only value if using <code>block</code> output
*<code>text</code>: alternative item name to display. Use <code>text=</code> to disable text output entirely
*<code>quantity</code>: ''EXPERIMENTAL'' prefix the item icon with a quantity, intended for inline use with default size
*<code>block</code>: display card as a block element the width of the icon, with item name underneath
==Examples==