Template:Icon: Difference between revisions

From Melvor Idle
(Did some shenanigans to allow for Icon calls on Melee)
(Added 'menu' option for infoboxes.)
Line 14: Line 14:
You can also just do <nowiki>{{Icon|Combat}}</nowiki> {{Icon|Combat}} if you need an icon for an image that doesn't belong to a given category.
You can also just do <nowiki>{{Icon|Combat}}</nowiki> {{Icon|Combat}} if you need an icon for an image that doesn't belong to a given category.


This template also has a 'notext' option for when you just want the icon, so <nowiki>{{Icon|Mastery|notext=true}}</nowiki> becomes {{Icon|Mastery|notext=true}}


Some special overrides exist:
Some special overrides exist:
Line 22: Line 21:
|<nowiki>{{Icon|Melee}}</nowiki> || {{Icon|Melee}}
|<nowiki>{{Icon|Melee}}</nowiki> || {{Icon|Melee}}
|}
|}
Other options:
The 'notext' option sends only the image (with link), so <nowiki>{{Icon|Mastery|notext=true}}</nowiki> becomes {{Icon|Mastery|notext=true}}
The 'menu' option formats the icon in a handy table (useful for menuboxes) so <nowiki>{{Icon|Combat|menu=true}}</nowiki> becomes {{Icon|Combat|menu=true}}


<includeonly><onlyinclude><!--
<includeonly><onlyinclude><!--
Line 33: Line 39:
Done to allow for easily fitting into combat triangle related tables
Done to allow for easily fitting into combat triangle related tables
-->{{#ifeq:{{#var:link}}|Melee|{{#vardefine:image|Combat}}{{#vardefine:link|Attack}}}}<!--
-->{{#ifeq:{{#var:link}}|Melee|{{#vardefine:image|Combat}}{{#vardefine:link|Attack}}}}<!--
-->[[File:{{#var:image}}{{#if:{{#var:type}}|_({{#var:type}})|}}.{{{ext|svg}}}|25px|link={{#var:link}}]]{{#if:{{{notext|}}}||&nbsp;[[{{#var:link}}|{{#var:text}}]]}}</onlyinclude></includonly>
Handling for 'menu' option
-->{{#if:{{{menu|}}}|{{{!}} class="articletable" style="display:inline-block; vertical-align:bottom;"
{{!}}-
{{!}}|}}<!--
-->[[File:{{#var:image}}{{#if:{{#var:type}}|_({{#var:type}})|}}.{{{ext|svg}}}|25px|link={{#var:link}}]]{{#if:{{{notext|}}}||&nbsp;[[{{#var:link}}|{{#var:text}}]]}}<!--
-->{{#if:{{{menu|}}}|<br/>
{{!}}}|}}</onlyinclude></includonly>

Revision as of 19:56, 2 September 2020

A generic version of the template used in things like Template:ItemIcon or Template:UpgradeIcon.

You probably want to use one of the following instead for most things:

Format is like so: {{Icon|type=combatArea|Castle of Kings|Knight Time}} becomes Castle of Kings (combatArea).svg Knight Time.

You can also just do {{Icon|Combat}} Combat.svg Combat if you need an icon for an image that doesn't belong to a given category.


Some special overrides exist:

Input Output
{{Icon|Melee}} Combat.svg Melee


Other options:

The 'notext' option sends only the image (with link), so {{Icon|Mastery|notext=true}} becomes Mastery.svg

The 'menu' option formats the icon in a handy table (useful for menuboxes) so {{Icon|Combat|menu=true}} becomes

Combat.svg Combat