Template:ItemCard: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
mNo edit summary |
(Experimental quantity parameter) |
||
Line 10: | Line 10: | ||
|format=list |
|format=list |
||
|no html |
|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}}}"> }}[[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> |
}} }}{{#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. |
Outputs an image of the item that links back to its page. |
||
==Usage== |
==Usage== |
||
Line 17: | 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>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>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 |
*<code>block</code>: display card as a block element the width of the icon, with item name underneath |
||
==Examples== |
==Examples== |
Revision as of 10:46, 12 June 2022
Outputs an image of the item that links back to its page.
Usage
{{ItemCard|Name[|32px[|text=AltName][|block]]}}
Options
32px
: 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 usingblock
outputtext
: alternative item name to display. Usetext=
to disable text output entirelyquantity
: EXPERIMENTAL prefix the item icon with a quantity, intended for inline use with default sizeblock
: display card as a block element the width of the icon, with item name underneath