<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sankoquest.wiki/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ASprite%2Fdoc</id>
	<title>Module:Sprite/doc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://sankoquest.wiki/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ASprite%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://sankoquest.wiki/w/index.php?title=Module:Sprite/doc&amp;action=history"/>
	<updated>2026-08-17T07:53:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://sankoquest.wiki/w/index.php?title=Module:Sprite/doc&amp;diff=653&amp;oldid=prev</id>
		<title>GrizzledAlchemistb40f9cb5: module documentation</title>
		<link rel="alternate" type="text/html" href="https://sankoquest.wiki/w/index.php?title=Module:Sprite/doc&amp;diff=653&amp;oldid=prev"/>
		<updated>2026-07-05T17:14:26Z</updated>

		<summary type="html">&lt;p&gt;module documentation&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This is the documentation page for [[Module:Sprite]].&lt;br /&gt;
&lt;br /&gt;
Renders an item icon from the Sanko item sprite atlas as a CSS background-positioned &amp;lt;code&amp;gt;&amp;amp;lt;span&amp;amp;gt;&amp;lt;/code&amp;gt;. Atlas coordinates come from the data module [[Module:Sprite/Item]] (loaded via &amp;lt;code&amp;gt;mw.loadData&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Functions ==&lt;br /&gt;
=== item ===&lt;br /&gt;
The only public function. Called as &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Sprite|item|name=...|size=...|link=...}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sanko-table&amp;quot;&lt;br /&gt;
! Parameter !! Meaning !! Default&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt; (or first positional) || Item name; must match a key in &amp;lt;code&amp;gt;Module:Sprite/Item&amp;lt;/code&amp;gt;&amp;#039;s &amp;lt;code&amp;gt;items&amp;lt;/code&amp;gt; table exactly (trimmed, case-sensitive). || —&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt; || Rendered icon size in pixels; the atlas is scaled by &amp;lt;code&amp;gt;size / cell&amp;lt;/code&amp;gt; (cell is 32). || 32&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;link&amp;lt;/code&amp;gt; || Page to wikilink the icon to. Empty = no link. || none&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Output is a &amp;lt;code&amp;gt;span.sanko-sprite&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;role=&amp;quot;img&amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;aria-label&amp;lt;/code&amp;gt;, and &amp;lt;code&amp;gt;data-minetip-title&amp;lt;/code&amp;gt; set to the item name, plus computed &amp;lt;code&amp;gt;background-position&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;background-size&amp;lt;/code&amp;gt;. When &amp;lt;code&amp;gt;link&amp;lt;/code&amp;gt; is set the span is wrapped in &amp;lt;code&amp;gt;span.sanko-sprite-link&amp;lt;/code&amp;gt; containing a wikilink.&lt;br /&gt;
&lt;br /&gt;
== Used by ==&lt;br /&gt;
* [[Template:ItemSprite]] — &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#invoke:Sprite|item|name={{{1|{{{name|}}}}}}|size={{{size|32}}}|link={{{link|}}}}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
* [[Template:Sprite]] — identical invocation.&lt;br /&gt;
&lt;br /&gt;
Prefer calling these templates from articles rather than &amp;lt;code&amp;gt;#invoke&amp;lt;/code&amp;gt; directly, e.g. &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{ItemSprite|Air Shard|size=32}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Notes and sharp edges ==&lt;br /&gt;
* The lookup is exact-match on the trimmed name. An unknown name does not error; it renders a &amp;lt;code&amp;gt;span.sanko-sprite-missing&amp;lt;/code&amp;gt; placeholder showing &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt; (minetip &amp;quot;Unknown item&amp;quot; when the name is blank). If an icon shows &amp;lt;code&amp;gt;?&amp;lt;/code&amp;gt;, check spelling/capitalization against [[Module:Sprite/Item]].&lt;br /&gt;
* The module only reads &amp;lt;code&amp;gt;frame.args&amp;lt;/code&amp;gt;, not the parent frame&amp;#039;s arguments — templates must pass &amp;lt;code&amp;gt;name&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;size&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;link&amp;lt;/code&amp;gt; through explicitly, as the two templates above do.&lt;br /&gt;
* The module sets background position/size only; the atlas image itself is attached by the &amp;lt;code&amp;gt;.sanko-sprite&amp;lt;/code&amp;gt; site CSS, not by this module. The &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;image&amp;lt;/code&amp;gt; fields in the data module are not read here.&lt;br /&gt;
* Offsets are &amp;lt;code&amp;gt;math.floor&amp;lt;/code&amp;gt;-ed after scaling, so sizes that are not multiples of the 32&amp;amp;nbsp;px cell can be off by up to a pixel.&lt;/div&gt;</summary>
		<author><name>GrizzledAlchemistb40f9cb5</name></author>
	</entry>
</feed>