Template:Item/doc

From Mod of Redemption Wiki
Jump to navigation Jump to search

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.

See examples below for more details.

unnamed parameter 1

Default item display name, link target, and image file name.

unnamed Parameter 2

Custom link text, which can include line breaks (<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.

mode

Display mode. It can be:

  • image(Preferred) or imageonly or onlyimage means only image will be displayed;
  • text(Preferred) or noimage means no image will be displayed;
  • table(Preferred) or 2-cell will output 2 cells code for table. This is roughly a shortcut for {{item|mode=image|itemname}} || {{item|mode=text|itemname}}

Use preferred values as much as possible to get the best performance.

image

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

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

size

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

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.
ext

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

link

Custom link target. If blank given(i.e. |link=|), it will be no link(See example below).

nolink = y/yes

Same as |link=|, only valid when there is no link input. If you use |link=somelink|nolink=y, it will be ignored.

anchor = y/yes

If set, will create an anchor for {{{1}}}.

note

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

note2

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

wrap = y/yes

Only valid when there is no note2= input. If set, note will be displayed in new line.

class

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

css or style

Custom css style rules.

Examples

Basic

Result Code Note
Dragon-Lead OreDragon-Lead Ore {{item|Dragon-Lead Ore}} Basic usage.
Dragon-Lead OreDragon-Lead {{item|Dragon-Lead Ore|Dragon-Lead}} Custom text.
Dragon-Lead OreDragon-Lead Ores {{item|Dragon-Lead Ore|s}} Plural.
Seed of InfectionSeed of Infection {{item|Seed of Infection|size=32px}} Custom image size. (Read Extended image syntax for details).
Seed of InfectionSeed of
Infection
{{item|Seed of Infection|size=32px|Seed of<br/>Infection}} Custom text in multiple lines.
Treasure BagTreasure Bags {{item|Treasure Bag|s|ext=gif}} Custom image file extension.
Treasure BagTreasure Bags(Expert Mode) {{item|Treasure Bag|s|note={{small|(Expert Mode)}}|ext=gif}} Note text.
DaerelWayfarers {{item|The Bois|image=Zephos.png|Wayfarers}} Custom image file name.
DaerelWayfarers {{item|Daerel|image=Zephos.png|Wayfarers|ext=jpg}} Will display Zephos.png, ext is ignored when image is specified.
ZephosWayfarers {{item|Zephos|link=Daerel|Wayfarers}} Custom link target.
UraniumUranium {{item|Uranium|link=}} Unlinked.
UraniumUranium {{item|Uranium|nolink=y}} Unlinked.
Dragon-Lead OreDragon-Lead Ore {{item|Dragon-Lead Ore|nolink=y|link=Dragon-Lead Alloy}} if link is specified, it will override unlink=y.
Dragon-Lead OreDragon-Lead Ore
{{item|Dragon-Lead Ore|anchor}} Create an anchor. Now {{PAGENAME}}#Dragon-Lead Ore will link to here.

Multiple images

Result Code Note
Xenium SmelterXenium SmelterXenium Smelter {{item|Xenium Smelter|image=Xenium Smelter.png/Xenium Smelter (placed).png}} Multiple images with auto size.
Xenium SmelterXenium SmelterXenium Smelter {{item|Xenium Smelter|image=Xenium Smelter.png/Xenium Smelter (placed).png|size=20px}} Only one size specified, all images will use this size.
Xenium SmelterXenium SmelterXenium Smelter {{item|Xenium Smelter|image=Xenium Smelter.png/Xenium Smelter (placed).png|size=30px/20px}} Multiple images with multiple sizes.
Xenium SmelterXenium SmelterXenium Smelter {{item|Xenium Smelter|image=Xenium Smelter.png/Xenium Smelter (placed).png|size=30px/20px/300px}} Size is more them images, extra size is ignored.
Xenium SmelterXenium SmelterXenium SmelterXenium Smelter {{item|Xenium Smelter|image=Xenium Smelter.png/Xenium Smelter (placed).png/Xenium Refinery.png|size=16px/50px}} Size is less then image, extra image will use auto size.

Wrap and note2

wrap is valid only when note2 is not specified.

Result Code Note
Thorium OreThorium Ore(some note) {{item|Thorium Ore|wrap=y|note=(some note)}} If there is a note, note will display on next line.
Thorium OreThorium Ore
some other notes.
{{item|Thorium Ore|wrap=y|note2=some other notes.}} If note2 is specified, note will be displayed on the same line, even if wrap=y.

Display mode

Result Code Note
Thorium OreThorium Ore {{item|Thorium Ore}} By default, it will display image and text info.
Thorium Ore {{item|Thorium Ore|mode=image}} mode=image: Only image will be displayed, no text, no note.
Thorium Ore(some note) {{item|Thorium Ore|mode=text|wrap=y|note=(some note)}} mode=text: image won't be displayed.
Thorium Ore Thorium Ore
Butterfly Staff Butterfly Staff(some note)
{| class="wikitable"
|{{item|Thorium Ore|mode=table}}
|-
|{{item|Butterfly Staff|note=(some note)|mode=table}}
|}
mode=table: output as two adjacent cells for table.

Css and predefined classes

Result Code Note
Thorium OreThorium Ore {{item|Thorium Ore|link=|css=color:red;border: 2px solid blue;padding: 3px; background:#ccc}} Custom css rules.
Thorium OreThorium Ore {{item|Thorium Ore|class=boldname}} Predefined class: boldname, item name will displayed in bold.
Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2
{{item|Thorium Ore|note=note|note2=note2|class=notecolor}}
{{item|Thorium Ore|note=note|note2=note2|class=note2color}}
{{item|Thorium Ore|note=note|note2=note2|css=color:red|class=note2color}}
Predefined class: notecolor and note2color, note or note2 will display in normal(inherited) text color, respectively .
Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2
{{item|Thorium Ore|note=note|note2=note2|class=notecolor}}
{{item|Thorium Ore|note=note|note2=note2|class=note2color}}
Predefined class: notesize and note2size, note will display in normal size, or note2 will display in reduced size, respectively.
Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2
{{item|Thorium Ore|note=note|note2=note2|class=left}}<br/>{{item|Thorium Ore|note=note|note2=note2|class=center}}<br/>{{item|Thorium Ore|note=note|note2=note2|class=right}} Predefined class: alignleft, aligncenter, and alignright, text-align = left, center, or right, respectively.
Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2

Thorium OreThorium Orenote
note2
{{item|Thorium Ore|note=note|note2=note2|class=textleft}}<br/>{{item|Thorium Ore|note=note|note2=note2|class=textcenter}}<br/>{{item|Thorium Ore|note=note|note2=note2|class=textright}} Predefined class: textleft, textcenter, and textright, Similar to alignleft/aligncenter/alignright, but only applied to text part.alignleft/center/right can use with text/align/center/right at same time.
Thorium Ore {{item|Thorium Ore|class=block|mode=text}} Predefined class: block, main item element and text element will display as block element(default is inline-block).It is usually only practical when mode=text.
Thorium OreThorium Orenote
note2
{{item|Thorium Ore|note=note|note2=note2|class=notesize notecolor boldname|css=color:red}} You can specify multiple classes, seperate with space, and can specify custom css rules at the same time.

Change default options

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

Usage

  • Set: {{item/options|nolink=y|...}} or {{item/options|set|nolink=y|...}}
  • get: {{item/options|get|nolink}}
  • reset: {{item/options|reset}} or {{item/options|resetall}}
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:

unnamed parameter 1

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

unnamed Parameter 2

The name of option which you want to get its value, only valid when action is get. Can be mode, wrap, nolink, class, css or style.

mode

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 default, all, or both for better readability) means change the mode back to default. See {{item}}'s mode parameter.

wrap = y/yes/n/no

Only valid when action is set. Turn on/off line wrap. See {{item}}'s wrap parameter.

anchor = y/yes/n/no

Only valid when action is set. Turn on/off anchor. See {{item}}'s anchor parameter.

nolink = y/yes/n/no

Only valid when action is set. Turn on/off no link option. See {{item}}'s nolink parameter.

class

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

css/style

Only valid when action is set. Default value for css. See {{item}}'s css parameter.

See examples below for more details.

Example

Code output
By default: 

{{item|Thorium Ore|note=(note)}}

turn on line wrap, and set to text mode: 
{{item/options|set|wrap=y|mode=text}}
{{item|Thorium Ore|note=(note)}}

turn on no link mode: 
{{item/options|set|nolink=y}}
{{item|Thorium Ore|note=(note)}}

This will be overrid by '''<code>link=</code>'''

{{item|Thorium Ore|note=(note)|link=Thorium Bar}}

get current setting:

nolink = {{item/options|get|nolink}} ; 
wrap = {{item/options|get|wrap}} ;
mode = {{item/options|get|mode}} ;

reset all options: 
{{item/options|reset}}
{{item|Thorium Ore|note=(note)}}

custom css and class:
{{item/options|set|css=border:1px solid red;padding:3px}}
{{item|Thorium Ore|note=(note)}}
{{item/options|set|class=boldname}}
{{item|Thorium Ore|note=(note)}}

reset all:
{{item/options|resetall}}
{{item|Thorium Ore|note=(note)}}

By default:

Thorium OreThorium Ore(note)

turn on line wrap, and set to text mode:

Thorium Ore(note)

turn on no link mode:

Thorium Ore(note)

This will be overrid by link=

Thorium Ore(note)

get current setting:

nolink = y ; wrap = y ; mode = text ;

reset all options:

Thorium OreThorium Ore(note)

custom css and class:

Thorium OreThorium Ore(note)

Thorium OreThorium Ore(note)

reset all:

Thorium OreThorium Ore(note)