Difference between revisions of "Template:Quality/doc"

From Stardew Valley Wiki
Jump to navigation Jump to search
(Update docs with full set of new parameters)
Line 1: Line 1:
 
==Description==
 
==Description==
This template is used to insert a quality star over an image.
+
This template displays an image with a superimposed quality star, i.e., a star colored to match the item's quality (Silver, Gold, Iridium).
  
 
==Usage==
 
==Usage==
This template can be used by entering the following onto a relevant page.
+
===Syntax===
 +
Basic usage:
 +
<nowiki>{{</nowiki>'''Quality'''|''item_name''|''quality''<nowiki>}}</nowiki>
  
<pre>
+
Complete argument list:
{{Quality
+
<nowiki>{{</nowiki>'''Quality'''|''item_name''|''quality''| size=''px'' | link=''link'' | alt=''alt'' <nowiki>}}</nowiki>
|image=Image name assuming the image is a .png (image)
+
 
|quality=denotes the star color (silver/gold/iridium)
+
===Parameters===
|size=size of the image (24/32/48)
+
There are two unnamed, required parameters, ''item_name'' and ''quality'.  All other parameters are named and optional.  Default value for all arguments is empty, unless specified otherwise.
}}
+
 
</pre>
+
* '''''item_name'''''
 +
** First unnamed parameter, required
 +
** The name of an item, or more specifically the name of the image (without .png)
 +
** Note that there must be no spaces following the item_name -- the "|" symbol must come immediately afterwards, or the template will fail (due to quirks of how mediawiki templates process arguments)
 +
** There is technically a default value, <tt>Blank_Icon</tt>, solely to make the template not generate errors in the default display on other languages.
 +
 
 +
* '''''quality'''''
 +
** Second unnamed parameter, required
 +
** Possible values are <tt>Silver</tt>, <tt>Gold</tt>, <tt>Iridium</tt>. Not case-sensitive.  All other values are ignored (i.e., no star is displayed). If missing, no star is displayed.
 +
** On other languages, the translated terms are also recognized.
 +
 
 +
* '''size=''px'''''
 +
** Size of icons in pixels.  Default value is 24.
 +
** Standard values are <tt>24</tt>, <tt>32</tt>, and <tt>48</tt>.  Other values will work, but the size of the overlay region is always one of the standard values (e.g., there may be extra white space around the image).
 +
** Only the number should be provided (do not append "px").<ref name="px">Technically, the template will strip any extra "px" from a provided size, but this usage is not recommended.</ref>
 +
** For backwards compatibility, the size can also be provided as a third unnamed argument (e.g., <tt><nowiki>{{Quality|Parsnip|Silver|24}}</nowiki></tt>).
 +
 
 +
* '''link=''link'''''
 +
** Name of page (without square brackets) that item icon should link to.  By default empty, meaning clicking on the icon does nothing.
 +
 
 +
* '''alt=''alt'''''
 +
** Alt text for item icon. Default value is ''link'' (if non-empty) or ''item_name''.
 +
** This is not normally directly displayed on the page, but may be used by screen readers or accessibility-aware browsers.
  
 
==Examples==
 
==Examples==
<pre>{{Quality|Parsnip|silver|32}}</pre>
+
<pre>{{Quality|Parsnip|silver}}</pre>
Result: {{Quality|Parsnip|silver|32}}
+
Result: {{Quality|Parsnip|silver}}
<pre>{{Quality|Kale|gold|48}}</pre>
+
<pre>{{Quality|Kale|Gold|32}}</pre>
Result: {{Quality|Kale|gold|48}}
+
Result: {{Quality|Kale|Gold|32}}
<pre>{{Quality|Potato||32}}</pre>
+
<pre>{{Quality|Potato|size=32|alt=Potato}}</pre>
{{Quality|Potato||32}}
+
{{Quality|Potato|size=32|alt=Potato}}
<pre>{{Quality|Milk|iridium|24}}</pre>
+
<pre>{{Quality|Milk|iridium|size=24|link=Milk}}</pre>
{{Quality|Milk|iridium|24}}
+
{{Quality|Milk|iridium|size=24|link=Milk}}
 +
 
 +
==Technical Details==
 +
<references>
 +
</references>
  
 
<includeonly>[[Category:Formatting templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
 
<includeonly>[[Category:Formatting templates]]</includeonly><noinclude>[[Category:Template documentation]]</noinclude>
<includeonly>{{Addlanglinks}}</includeonly>
 

Revision as of 14:39, 4 September 2020

Description

This template displays an image with a superimposed quality star, i.e., a star colored to match the item's quality (Silver, Gold, Iridium).

Usage

Syntax

Basic usage:

{{Quality|item_name|quality}}

Complete argument list:

{{Quality|item_name|quality| size=px | link=link | alt=alt }}

Parameters

There are two unnamed, required parameters, item_name and quality'. All other parameters are named and optional. Default value for all arguments is empty, unless specified otherwise.

  • item_name
    • First unnamed parameter, required
    • The name of an item, or more specifically the name of the image (without .png)
    • Note that there must be no spaces following the item_name -- the "|" symbol must come immediately afterwards, or the template will fail (due to quirks of how mediawiki templates process arguments)
    • There is technically a default value, Blank_Icon, solely to make the template not generate errors in the default display on other languages.
  • quality
    • Second unnamed parameter, required
    • Possible values are Silver, Gold, Iridium. Not case-sensitive. All other values are ignored (i.e., no star is displayed). If missing, no star is displayed.
    • On other languages, the translated terms are also recognized.
  • size=px
    • Size of icons in pixels. Default value is 24.
    • Standard values are 24, 32, and 48. Other values will work, but the size of the overlay region is always one of the standard values (e.g., there may be extra white space around the image).
    • Only the number should be provided (do not append "px").[1]
    • For backwards compatibility, the size can also be provided as a third unnamed argument (e.g., {{Quality|Parsnip|Silver|24}}).
  • link=link
    • Name of page (without square brackets) that item icon should link to. By default empty, meaning clicking on the icon does nothing.
  • alt=alt
    • Alt text for item icon. Default value is link (if non-empty) or item_name.
    • This is not normally directly displayed on the page, but may be used by screen readers or accessibility-aware browsers.

Examples

{{Quality|Parsnip|silver}}

Result:

Parsnip.png
Silver Quality Icon.png
{{Quality|Kale|Gold|32}}

Result:

Kale.png
Gold Quality Icon.png
{{Quality|Potato|size=32|alt=Potato}}
Potato.png
{{Quality|Milk|iridium|size=24|link=Milk}}
Milk.png
Iridium Quality Icon.png

Technical Details

  1. Technically, the template will strip any extra "px" from a provided size, but this usage is not recommended.