@DeletedUser40526905 (talk | contribs) (Undo revision 24236 by IllegalOpcode (talk) because apparently MediaWiki is smarter than I thought) |
(added example for mod-item) |
||
(13 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{{doc/start}} |
{{doc/start}} |
||
− | Link to an item page with an item image in front: {{ItemLink| |
+ | Link to an item page with an item image in front: {{ItemLink|Stone}} |
+ | Also supports an optional quantity in front: {{ItemLink|Stone|quantity=5}} |
||
⚫ | |||
⚫ | |||
⚫ | |||
− | <nowiki>{{ItemLink|item=Stone|text=Stone|link=Stone|image=Stone|size=20px}}</nowiki> |
||
⚫ | |||
{| class="wikitable" |
{| class="wikitable" |
||
Line 12: | Line 12: | ||
! Name !! Type !! Required !! Default |
! Name !! Type !! Required !! Default |
||
|- |
|- |
||
− | || <code> |
+ | || <code>0</code> |
|| <code>string</code> |
|| <code>string</code> |
||
|| <code>true</code> |
|| <code>true</code> |
||
+ | || |
||
− | || ''None'' |
||
|- |
|- |
||
|| <code>text</code> |
|| <code>text</code> |
||
|| <code>string</code> |
|| <code>string</code> |
||
|| <code>false</code> |
|| <code>false</code> |
||
− | || The value of the |
+ | || The value of the first positional parameter, or the second if given |
|- |
|- |
||
|| <code>link</code> |
|| <code>link</code> |
||
|| <code>string</code> |
|| <code>string</code> |
||
|| <code>false</code> |
|| <code>false</code> |
||
− | || The value of the |
+ | || The value of the first positional parameter |
|- |
|- |
||
|| <code>image</code> |
|| <code>image</code> |
||
|| <code>string</code> |
|| <code>string</code> |
||
|| <code>false</code> |
|| <code>false</code> |
||
− | || The value of the |
+ | || The value of the first positional parameter suffixed with <code>.png</code> |
|- |
|- |
||
|| <code>size</code> |
|| <code>size</code> |
||
− | || <code> |
+ | || <code>string</code> |
|| <code>false</code> |
|| <code>false</code> |
||
|| 20px |
|| 20px |
||
+ | |- |
||
+ | || <code>quantity</code> |
||
+ | || <code>string</code> |
||
+ | || <code>false</code> |
||
+ | || |
||
+ | |- |
||
+ | || <code>noDlcIcon</code> |
||
+ | || <code>bool</code> |
||
+ | || <code>false</code> |
||
+ | || |
||
|} |
|} |
||
Line 41: | Line 51: | ||
Both lines produce the same output: |
Both lines produce the same output: |
||
− | <code><nowiki>{{ItemLink| |
+ | <code><nowiki>{{ItemLink|Stone}}</nowiki></code> = {{ItemLink|Stone}} |
− | <code><nowiki>{{ItemLink| |
+ | <code><nowiki>{{ItemLink|Stone|text=Stone|link=Stone|image=Stone.png|size=20px|quantity=}}</nowiki></code> = {{ItemLink|Stone|text=Stone|link=Stone|image=Stone.png|size=20px|quantity=}} |
Lowercase link: |
Lowercase link: |
||
− | <code><nowiki>{{ItemLink| |
+ | <code><nowiki>{{ItemLink|Stone|text=stone}}</nowiki></code> = {{ItemLink|Stone|text=stone}}<br> |
+ | <code><nowiki>{{ItemLink|Stone|stone}}</nowiki></code> = {{ItemLink|Stone|stone}} |
||
Plural link: |
Plural link: |
||
− | <code><nowiki>{{ItemLink| |
+ | <code><nowiki>{{ItemLink|Stone|text=Stones}}</nowiki></code> = {{ItemLink|Stone|text=Stones}}<br> |
+ | Alternative: <code><nowiki>{{ItemLink|Stone}}s</nowiki></code> = {{ItemLink|Stone}}s |
||
+ | |||
+ | Quantity: |
||
+ | |||
+ | <code><nowiki>{{ItemLink|Stone|quantity=5}}</nowiki></code> = {{ItemLink|Stone|quantity=5}}<br> |
||
+ | <code><nowiki>{{ItemLink|Stone|quantity=5-10}}</nowiki></code> = {{ItemLink|Stone|quantity=5-10}} |
||
+ | |||
+ | DLC-suffices are converted automatically to the according icon, if no explicit link-text is given |
||
+ | |||
+ | <code><nowiki>{{ItemLink|Sand (Scorched Earth)}}</nowiki></code> = {{ItemLink|Sand (Scorched Earth)}}<br> |
||
+ | <code><nowiki>{{ItemLink|Sand (Scorched Earth)|Sand}}</nowiki></code> = {{ItemLink|Sand (Scorched Earth)|Sand}} |
||
+ | |||
+ | Mods that are supported will have the mod-part replaced with their icon |
||
+ | |||
+ | <code><nowiki>{{ItemLink|Mod:Ark Eternal/Alpha Meat}}</nowiki></code> = {{ItemLink|Mod:Ark Eternal/Alpha Meat}} |
||
+ | |||
+ | The parameter noDlcIcon hides the extra DLC-/mod-icon |
||
+ | |||
+ | <code><nowiki>{{ItemLink|Sand (Scorched Earth)|noDlcIcon=1}}</nowiki></code> = {{ItemLink|Sand (Scorched Earth)|noDlcIcon=1}}<br> |
||
+ | |||
{{doc/end}} |
{{doc/end}} |
||
Line 60: | Line 91: | ||
"description": "Link to an item page with an item image in front", |
"description": "Link to an item page with an item image in front", |
||
"params": { |
"params": { |
||
− | " |
+ | "0": { |
"label": "Item name", |
"label": "Item name", |
||
"description": "The item.", |
"description": "The item.", |
||
Line 84: | Line 115: | ||
"label": "Size", |
"label": "Size", |
||
"description": "The image size. Defaults to 20px.", |
"description": "The image size. Defaults to 20px.", |
||
+ | "type": "string" |
||
+ | }, |
||
+ | "quantity": { |
||
+ | "label": "Quantity", |
||
+ | "description": "The quantity to display to the left of the image.", |
||
"type": "number" |
"type": "number" |
||
} |
} |
||
Line 90: | Line 126: | ||
</templatedata> |
</templatedata> |
||
--> |
--> |
||
+ | [[it:Template:ItemLink/doc]] |
Revision as of 22:46, 3 January 2020
Link to an item page with an item image in front: Stone
Also supports an optional quantity in front: 5 × Stone
Usage
{{ItemLink|Stone}}
Name | Type | Required | Default |
---|---|---|---|
0
|
string
|
true
|
|
text
|
string
|
false
|
The value of the first positional parameter, or the second if given |
link
|
string
|
false
|
The value of the first positional parameter |
image
|
string
|
false
|
The value of the first positional parameter suffixed with .png
|
size
|
string
|
false
|
20px |
quantity
|
string
|
false
|
|
noDlcIcon
|
bool
|
false
|
Examples
Both lines produce the same output:
{{ItemLink|Stone}}
= Stone
{{ItemLink|Stone|text=Stone|link=Stone|image=Stone.png|size=20px|quantity=}}
= Stone
Lowercase link:
{{ItemLink|Stone|text=stone}}
= stone
{{ItemLink|Stone|stone}}
= stone
Plural link:
{{ItemLink|Stone|text=Stones}}
= Stones
Alternative: {{ItemLink|Stone}}s
= Stones
Quantity:
{{ItemLink|Stone|quantity=5}}
= 5 × Stone
{{ItemLink|Stone|quantity=5-10}}
= 5-10 × Stone
DLC-suffices are converted automatically to the according icon, if no explicit link-text is given
{{ItemLink|Sand (Scorched Earth)}}
= Sand
{{ItemLink|Sand (Scorched Earth)|Sand}}
= Sand
Mods that are supported will have the mod-part replaced with their icon
{{ItemLink|Mod:Ark Eternal/Alpha Meat}}
= Alpha Meat
The parameter noDlcIcon hides the extra DLC-/mod-icon
{{ItemLink|Sand (Scorched Earth)|noDlcIcon=1}}
= Sand