User:Westgrass/sandbox

An all-in-one template for display item name/icon/link.

By default, displays a link to the item and adds an item icon in front of it.

Usage
All parameters are optional. Despite this, some combinations are invalid and may cause errors, e.g.

See examples below for more details.

Default item display name, link target, and image file name. If unspecitied, will try to retrieve it from.
 * unnamed parameter 1

Custom link text, which can include line breaks (&lt;br />) and other wikitext. If an 's', 'es', 'ies' or 'ves' is passed as the custom text, it will be appended to the end of the item name. Pluralism is partially intuitive - adding 's' to Butterfly will return Butterflies. For non-english language, auto tranlation will be applied.
 * unnamed Parameter 2

Custom link text, it will override unnamed Parameter 2, and it will be displayed as-is, without plural processing and auto tranlation.
 * t

Display mode. It can be: Use preferred values as much as possible to get the best performance.
 * mode
 *  (Preferred) or   or   means only image will be displayed;
 *  (Preferred) or   means no image will be displayed;
 *  (Preferred) or   will output 2 cells code for table. This is roughly a shortcut for

image filename, no brackets nor "File:"(must include file extension, eg. Parrot.png).
 * image

You can specify multiple images, just seperate filenames with slashes(eg. Parrot.png/Parrot (placed).png).

Custom graphic size (Read Extended image syntax for details).
 * size

You can specify multiple sizes, just seperated with slashes(eg. 32px/24x24px).

When multiple images specified:
 * If only one size specified, it will apply to all images
 * if size is less then image, extra images will be displayed as if they don't have size argument
 * if size is more then image, extra sizes will simply be ignored.

And you can append it with  to scale image, e.g. ,   ...

Image(s) will be scaled based on  and. e.g.  is equal to. This will multiply with scale factor in size paramter,  is equal to. scale can be set by options.
 * scale

Image size limit. Using standard image size syntax, eg. 32px/24x24px. will be applied after scale.
 * maxsize

image file extension, default is png. Only valid when there is no image input.
 * ext

Custom link target. If blank given(i.e.  ), it will be no link(See example below). Note: eicons also will base on link first.
 * link

Same as  , only valid when there is no   input. If you use  , it will be ignored.
 * nolink = y/yes

If set, will create an anchor for  .
 * anchor = y/yes

Extra note text. By default, it will displayed as smaller and gray text between item name and platform icons, and without link on it.
 * note

Another note text. By default, it will displayed as gray txt in normal size, without link, and always take a single line.
 * note2

Only valid when there is no id= or note2= input. If set, platform icons and/or note will be displayed in new line.
 * wrap = y/yes

n/no=suppresses the platform icons; default is yes.
 * icons = n/no/y/yes

Number, will display items(or other type) ID infomation.
 * id

the type of ID, case-insensitive, default is  , only valid when id is sepcified. can be  ,  ,  ,  ,  ,  ,  , or  . All other values are treated as  .
 * type

Explicitly turn on/off id display. Default is on when  is set, off when   is not set. If  is turned on and   is not set, will auto retrieve id from database (using data templates such as  itemIdFromName, according to value of  ).
 * showid = y/yes/n/no

Reduces the size of the platform icons (useful when space is an issue).
 * small = y/yes

Custom Css class(es). There're some predefined classes for certain formatting purpose(see examples below). You can add yours if needed.
 * class

Custom css style rules.
 * css or style

Size and scale
Note: Due to the way of 's size option works, if you want to set a size(after scale) larger then origin image size, you need to set it in DDpx or DDxDDpx, and xDDpx will be no effect. e.g. for Beeswax,  will be no effect.

Wrap, id and note2
is valid only when  and   are not specified.

Display mode
{| class="terraria lined" !Result !! Code !! Note
 * ||  || By default, it will display image and text info.
 * ||  ||  : Only image will be displayed, no text, no note, no id, and no platform icons.
 * ||  ||  : image won't be displayed.
 * ||  ||  : Only image will be displayed, no text, no note, no id, and no platform icons.
 * ||  ||  : image won't be displayed.
 * ||  ||  : image won't be displayed.


 * : output as two adjacent cells for table.


 * : rowspan


 * : hide border between 2 cells.
 * }

Transform
You can transform item image via these CSS classes.

The transformation happens at the center of the image and its effective dimensions will retain the original values of the object as if untransformed. So be careful with  and.

Change default options
You can use item/options to set/get and reset some options' default value.

Usage

 * Set:   or  
 * get:  
 * reset:   or  

'''NOTE: In order to avoid unwanted influences, it is very important to reset options as soon as possible. Especially in the template, you should reset options before the template ends.'''

All parameters:

Action.   or   means get the current value of a option,   or   means reset all options to default value, other values(include none. if you want, recommend to use   for better readability) means set options' value.
 * unnamed parameter 1

The name of option which you want to get its value, only valid when action is get. Can be  ,  ,  ,  ,  ,  ,  ,   or  .
 * unnamed Parameter 2

Only valid when action is set. Turn on/off reduced size for platform icons. See item's   parameter.
 * small/smallicons = y/yes/n/no

Only valid when action is set. Turn on/off platform icons display. When turn off, item will be faster. See item's   parameter.
 * icons = y/yes/n/no

Only valid when action is set. Set the default value for item's mode parameter. You can use any valid value for item's mode parameter, and a invalid value(recommend to use  ,  , or   for better readability) means change the mode back to default. See item's   parameter.
 * mode

Only valid when action is set. Turn on/off line wrap. See item's   parameter.
 * wrap = y/yes/n/no

Only valid when action is set. Turn on/off anchor. See item's   parameter.
 * anchor = y/yes/n/no

Only valid when action is set. Turn on/off no link option. See item's   parameter.
 * nolink = y/yes/n/no

Only valid when action is set. Default value for  . See item's   parameter.
 * class

Only valid when action is set. Default value for  . See item's   parameter.
 * css/style

Only valid when action is set. Default value for  . See item's   parameter.
 * maxsize

Only valid when action is set. Default value for  . See item's   parameter.
 * showid

See examples below for more details.

About Translation
item is i18n-ready and integrated automatic translation. When translate to other language, It may not require any edit, auto translation will get things done, for example: if there is still English text, or you want to modify display text, please keep unnamed parameter 1 untouched(item will handle the image and link target), and change unnamed parameter 2, for example:

de:Vorlage:Item fr:Modèle:Item hu:Sablon:Item ko:틀:아이템 링크 pl:Szablon:Item pt:Predefinição:Item ru:Шаблон:Предмет uk:Шаблон:Item zh:模板:Item