<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.you107657.duckdns.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AItem</id>
	<title>Module:Item - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.you107657.duckdns.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AItem"/>
	<link rel="alternate" type="text/html" href="https://wiki.you107657.duckdns.org/index.php?title=Module:Item&amp;action=history"/>
	<updated>2026-09-27T23:46:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.you107657.duckdns.org/index.php?title=Module:Item&amp;diff=13173&amp;oldid=prev</id>
		<title>imported&gt;Merge: merge.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.you107657.duckdns.org/index.php?title=Module:Item&amp;diff=13173&amp;oldid=prev"/>
		<updated>2026-09-25T10:55:52Z</updated>

		<summary type="html">&lt;p&gt;merge.py&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 10:55, 25 September 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key tensura:diff:1.41:old-5356:rev-13173 --&gt;
&lt;/table&gt;</summary>
		<author><name>imported&gt;Merge</name></author>
	</entry>
	<entry>
		<id>https://wiki.you107657.duckdns.org/index.php?title=Module:Item&amp;diff=5356&amp;oldid=prev</id>
		<title>imported&gt;Merge: merge.py</title>
		<link rel="alternate" type="text/html" href="https://wiki.you107657.duckdns.org/index.php?title=Module:Item&amp;diff=5356&amp;oldid=prev"/>
		<updated>2026-09-25T10:55:52Z</updated>

		<summary type="html">&lt;p&gt;merge.py&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local tr = require(&amp;#039;Module:tr&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
---Holds the tables with the l10n information for the different languages, taken from the l10n submodule.&lt;br /&gt;
local l10n_info = mw.loadData(&amp;#039;Module:Item/l10n&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
---Holds the l10n information for the current language, as key-value pairs.&lt;br /&gt;
local l10n_table&lt;br /&gt;
&lt;br /&gt;
---The current language. Determines which l10n table to use.&lt;br /&gt;
local lang&lt;br /&gt;
&lt;br /&gt;
local md5 = function(str)&lt;br /&gt;
	return mw.hash.hashValue(&amp;#039;md5&amp;#039;, str)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local trim = mw.text.trim&lt;br /&gt;
local cargo = mw.ext.cargo&lt;br /&gt;
local eicons = require(&amp;#039;Module:Exclusive&amp;#039;).simpleEicons&lt;br /&gt;
local cache = require &amp;#039;mw.ext.LuaCache&amp;#039;&lt;br /&gt;
&lt;br /&gt;
local should_cache = true&lt;br /&gt;
&lt;br /&gt;
---A cached version of the current frame, the interface to the parser.&lt;br /&gt;
local currentFrame&lt;br /&gt;
---Holds the arguments from the template call.&lt;br /&gt;
local args_table&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
---Return the l10n string associated with the `key`.&lt;br /&gt;
---@param key string&lt;br /&gt;
---@return string&lt;br /&gt;
local function l10n(key)&lt;br /&gt;
	return l10n_table[key] or l10n_info[&amp;#039;en&amp;#039;][key]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Return a trimmed version of the value of the template parameter with the specified `key`.&lt;br /&gt;
---Return `nil` if the parameter is empty or unset.&lt;br /&gt;
---@param key string|number&lt;br /&gt;
---@return string|nil&lt;br /&gt;
local function getArg(key)&lt;br /&gt;
	local value = args_table[key]&lt;br /&gt;
	if not value then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	value = trim(value)&lt;br /&gt;
	if value == &amp;#039;&amp;#039; then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	return value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Convert a string of parameters in a `@param1:value^@param2:value^` format to a table.&lt;br /&gt;
---Change the `name` and `text` parameters to `1` and `2`, respectively.&lt;br /&gt;
---@param paramstr string&lt;br /&gt;
---@return table&lt;br /&gt;
local function parse(paramstr)&lt;br /&gt;
	local args = {}&lt;br /&gt;
	for s in string.gmatch(paramstr, &amp;#039;%b@^&amp;#039;) do&lt;br /&gt;
		local k,v = string.match(s, &amp;#039;^@(.-):(.*)^$&amp;#039;)&lt;br /&gt;
		args[k] = v&lt;br /&gt;
	end&lt;br /&gt;
	args[1] = args[&amp;#039;name&amp;#039;]&lt;br /&gt;
	args[2] = args[&amp;#039;text&amp;#039;]&lt;br /&gt;
	return args&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getCacheKey(arg)&lt;br /&gt;
	return &lt;br /&gt;
	&amp;quot;@name:&amp;quot;..(arg[1] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@text:&amp;quot;..(arg[2] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@mode:&amp;quot;..(arg[&amp;#039;mode&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@rowspan:&amp;quot;..(arg[&amp;#039;rowspan&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@image:&amp;quot;..(arg[&amp;#039;image&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@scale:&amp;quot;..(arg[&amp;#039;scale&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@size:&amp;quot;..(arg[&amp;#039;size&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@maxsize:&amp;quot;..(arg[&amp;#039;maxsize&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@ext:&amp;quot;..(arg[&amp;#039;ext&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@nolink:&amp;quot;..(arg[&amp;#039;nolink&amp;#039;] and &amp;#039;y&amp;#039; or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@link:&amp;quot;..(arg[&amp;#039;link&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@icons:&amp;quot;..(arg[&amp;#039;icons&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@small:&amp;quot;..(arg[&amp;#039;small&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@note:&amp;quot;..(arg[&amp;#039;note&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@note2:&amp;quot;..(arg[&amp;#039;note2&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@bignote:&amp;quot;..(arg[&amp;#039;bignote&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@id:&amp;quot;..(arg[&amp;#039;id&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@showid:&amp;quot;..(arg[&amp;#039;showid&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@type:&amp;quot;..(arg[&amp;#039;type&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@wrap:&amp;quot;..(arg[&amp;#039;wrap&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@class:&amp;quot;..(arg[&amp;#039;class&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@css:&amp;quot;..(arg[&amp;#039;css&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@lang:&amp;quot;..(arg[&amp;#039;lang&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^@anchor:&amp;quot;..(arg[&amp;#039;anchor&amp;#039;] or &amp;#039;&amp;#039;)..&lt;br /&gt;
	&amp;quot;^&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Split the `str` on each `div` in it and return the result as a table.&lt;br /&gt;
---Original version credit: http://richard.warburton.it. This version trims each substring.&lt;br /&gt;
---@param div string&lt;br /&gt;
---@param str string&lt;br /&gt;
---@return table|boolean&lt;br /&gt;
local function explode(div,str)&lt;br /&gt;
	if (div==&amp;#039;&amp;#039;) then return false end&lt;br /&gt;
	local pos,arr = 0,{}&lt;br /&gt;
	-- for each divider found&lt;br /&gt;
	for st,sp in function() return string.find(str,div,pos,true) end do&lt;br /&gt;
		arr[#arr + 1] = trim(string.sub(str,pos,st-1)) -- Attach chars left of current divider&lt;br /&gt;
		pos = sp + 1 -- Jump past current divider&lt;br /&gt;
	end&lt;br /&gt;
	arr[#arr + 1] = trim(string.sub(str,pos)) -- Attach chars right of last divider&lt;br /&gt;
	return arr&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Extract scale, width, and height from an input string. Up to two of the three can be empty in the input.&lt;br /&gt;
---Example: `5x7px*0.75` → `0.75`, `5`, `7`&lt;br /&gt;
---@param size string&lt;br /&gt;
---@return string basescale&lt;br /&gt;
---@return number width&lt;br /&gt;
---@return number height&lt;br /&gt;
local function parseSize(size)&lt;br /&gt;
	if not size then return end&lt;br /&gt;
	local basescale, width, height&lt;br /&gt;
	size, basescale = unpack(explode(&amp;#039;*&amp;#039;, size))&lt;br /&gt;
	if size ~= &amp;#039;&amp;#039; then&lt;br /&gt;
		width, height = unpack(explode(&amp;#039;x&amp;#039;, string.gsub(size, &amp;#039;px&amp;#039;, &amp;#039;&amp;#039;)))&lt;br /&gt;
		width, height = tonumber(width), tonumber(height)&lt;br /&gt;
		if width == 0 then width = nil end&lt;br /&gt;
		if height == 0 then height = nil end&lt;br /&gt;
	end&lt;br /&gt;
	return basescale, width, height&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Return width, height, and caching date for the specified `imagename` from the Imageinfo cargo table.&lt;br /&gt;
---@param imagename string&lt;br /&gt;
---@return number width&lt;br /&gt;
---@return number height&lt;br /&gt;
---@return string cached&lt;br /&gt;
local function getInfoFromCargo(imagename)&lt;br /&gt;
	-- try to get from cargo cache&lt;br /&gt;
	local result = mw.ext.cargo.query(&amp;#039;Imageinfo&amp;#039;, &amp;#039;width, height, cached&amp;#039;, {&lt;br /&gt;
		-- md5name for case-sensitive query.&lt;br /&gt;
		where = &amp;#039;md5name=&amp;#039;.. &amp;quot;&amp;#039;&amp;quot;..md5(imagename)..&amp;quot;&amp;#039;&amp;quot;,&lt;br /&gt;
		orderBy = &amp;quot;cached DESC&amp;quot;,&lt;br /&gt;
		limit = 1,&lt;br /&gt;
	})&lt;br /&gt;
	for _, row in ipairs(result) do&lt;br /&gt;
		return tonumber(row[&amp;#039;width&amp;#039;]), tonumber(row[&amp;#039;height&amp;#039;]), row[&amp;#039;cached&amp;#039;]&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Store width and height of the specified `imagename` to the Imageinfo cargo table and return them.&lt;br /&gt;
---Width and height are computed via the `#imgw:` and `#imgh:` parser functions, respectively.&lt;br /&gt;
---@param imagename string&lt;br /&gt;
---@return number width&lt;br /&gt;
---@return number height&lt;br /&gt;
local function storeInfoToCargo(imagename)&lt;br /&gt;
	-- don&amp;#039;t cache {{item}}&amp;#039;s result when parsing imagesize fails.&lt;br /&gt;
	should_cache = false&lt;br /&gt;
	local imageTitle = mw.title.new(&amp;quot;File:&amp;quot; .. imagename)&lt;br /&gt;
	local width, height = imageTitle.file.width, imageTitle.file.height&lt;br /&gt;
	if width and width ~= 0 and height and height ~= 0 then&lt;br /&gt;
		should_cache = true -- ok, cache it.&lt;br /&gt;
		currentFrame:callParserFunction(&amp;#039;#cargo_store:_table=Imageinfo&amp;#039;,{&lt;br /&gt;
			image = imagename,&lt;br /&gt;
			md5name = md5(imagename),&lt;br /&gt;
			width = width,&lt;br /&gt;
			height = height,&lt;br /&gt;
			cached = os.time(),&lt;br /&gt;
		})&lt;br /&gt;
	end&lt;br /&gt;
	return width, height&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Retrieve the dimensions of the specified `image` from the Imageinfo cargo table.&lt;br /&gt;
---If it doesn&amp;#039;t have any data for the image yet, store it.&lt;br /&gt;
---@param imagename string&lt;br /&gt;
---@return number width&lt;br /&gt;
---@return number height&lt;br /&gt;
local function getSizeInfo(imagename)&lt;br /&gt;
	local width, height, cached = getInfoFromCargo(imagename)&lt;br /&gt;
	-- cache missed, init cache&lt;br /&gt;
	if not cached then&lt;br /&gt;
		width, height = storeInfoToCargo(imagename)&lt;br /&gt;
	end&lt;br /&gt;
	if width == 0 then width = nil end&lt;br /&gt;
	if height == 0 then height = nil end&lt;br /&gt;
	return width, height&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Compute the final width and height of the image.&lt;br /&gt;
---If necessary, retrieve data from or store data to the Imageinfo cargo table.&lt;br /&gt;
---@param imagename string&lt;br /&gt;
---@param width number&lt;br /&gt;
---@param height number&lt;br /&gt;
---@param scale number&lt;br /&gt;
---@param maxwidth number&lt;br /&gt;
---@param maxheight number&lt;br /&gt;
---@return number width&lt;br /&gt;
---@return number height&lt;br /&gt;
local function getImageSize(imagename, width, height, scale, maxwidth, maxheight)&lt;br /&gt;
	-- get size info from image file itself (may be expensive)&lt;br /&gt;
	local w, h = getSizeInfo(imagename) -- store data to cache&lt;br /&gt;
&lt;br /&gt;
	-- if width and height are not given as input, but scale/maxwidth/maxheight are, then&lt;br /&gt;
	-- set width and height to the original dimensions of the image&lt;br /&gt;
	if not width and not height and (scale or maxwidth or maxheight) then&lt;br /&gt;
		width, height = w, h&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- apply scale to width/height if needed&lt;br /&gt;
	if scale then&lt;br /&gt;
		if width then width = width * scale end&lt;br /&gt;
		if height then height = height * scale end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- apply maxwidth/maxheight&lt;br /&gt;
	if maxwidth then&lt;br /&gt;
		if width then&lt;br /&gt;
			if width &amp;gt; maxwidth then width = maxwidth end&lt;br /&gt;
		else&lt;br /&gt;
			if height then width = maxwidth end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if maxheight then&lt;br /&gt;
		if height then&lt;br /&gt;
			if height &amp;gt; maxheight then height = maxheight end&lt;br /&gt;
		else&lt;br /&gt;
			if width then height = maxheight end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- round to natural numbers&lt;br /&gt;
	if width then width = math.ceil(width) end&lt;br /&gt;
	if height then height = math.ceil(height) end&lt;br /&gt;
&lt;br /&gt;
	return width, height&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Extract width and height from an input string.&lt;br /&gt;
---Example: `6x9px` → `6`, `9`&lt;br /&gt;
---@param maxsize string&lt;br /&gt;
---@return number maxwidth&lt;br /&gt;
---@return number maxheight&lt;br /&gt;
local function parseMaxSize(maxsize)&lt;br /&gt;
	if not maxsize then return end&lt;br /&gt;
	local maxwidth, maxheight = unpack(explode(&amp;#039;x&amp;#039;, string.gsub(maxsize, &amp;#039;px&amp;#039;, &amp;#039;&amp;#039;)))&lt;br /&gt;
	maxwidth, maxheight = tonumber(maxwidth), tonumber(maxheight)&lt;br /&gt;
	if maxwidth == 0 then maxwidth = nil end&lt;br /&gt;
	if maxheight == 0 then maxheight = nil end&lt;br /&gt;
	return maxwidth, maxheight&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Assemble the final wikicode for an image.&lt;br /&gt;
---@param imagename string&lt;br /&gt;
---@param link string&lt;br /&gt;
---@param text string&lt;br /&gt;
---@param size string As accepted by the `[[File:` syntax, e.g. `5x7px*0.75`.&lt;br /&gt;
---@param scale number This will be multiplied by the scale in `size`, if necessary.&lt;br /&gt;
---@param maxsize string&lt;br /&gt;
---@return string&lt;br /&gt;
local function imagecode(imagename, link, text, size, scale, maxsize)&lt;br /&gt;
	local image_output = &amp;#039;[[File:&amp;#039; .. imagename .. &amp;#039;|link=&amp;#039;.. link .. &amp;#039;|&amp;#039; .. text&lt;br /&gt;
	if size or scale or maxsize then&lt;br /&gt;
		local basescale, width, height = parseSize(size) -- width, height: number or nil (basescale is string!)&lt;br /&gt;
		scale = (tonumber(scale) or 1) * (tonumber(basescale) or 1) -- combine the scale parameter and scale from the size parameter&lt;br /&gt;
		if scale == 0 or scale == 1 then&lt;br /&gt;
			scale = nil&lt;br /&gt;
		end&lt;br /&gt;
		local maxwidth, maxheight = parseMaxSize(maxsize)&lt;br /&gt;
		width, height = getImageSize(imagename, width, height, scale, maxwidth, maxheight) -- can be 0&lt;br /&gt;
		if width or height then&lt;br /&gt;
			image_output = image_output .. &amp;#039;|&amp;#039; .. (width or &amp;#039;&amp;#039;) .. &amp;#039;x&amp;#039; .. (height or &amp;#039;&amp;#039;) .. &amp;#039;px&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return image_output .. &amp;#039;]]&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Return the full `[[File:` wikicode for each image in the input (multiple are separated with `/`).&lt;br /&gt;
---@param image string&lt;br /&gt;
---@param link string&lt;br /&gt;
---@param text string&lt;br /&gt;
---@param size string&lt;br /&gt;
---@param scale string&lt;br /&gt;
---@param maxsize string&lt;br /&gt;
---@return string&lt;br /&gt;
local function images(image, link, text, size, scale, maxsize)&lt;br /&gt;
&lt;br /&gt;
	if not image:find(&amp;#039;/&amp;#039;) then&lt;br /&gt;
		-- there is only one image in the input&lt;br /&gt;
		return imagecode(image, link, text, size, scale, maxsize)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- there are multiple images in the input, separated with a slash&lt;br /&gt;
	image = explode(&amp;#039;/&amp;#039;, image)&lt;br /&gt;
	local result = &amp;#039;&amp;#039;&lt;br /&gt;
	if size and size:find(&amp;#039;/&amp;#039;) then&lt;br /&gt;
		-- there are multiple sizes in the size parameter&lt;br /&gt;
		size = explode(&amp;#039;/&amp;#039;, size) -- so turn it into a table&lt;br /&gt;
		for i, v in ipairs(image) do -- iterate over the images&lt;br /&gt;
			result = result .. imagecode(v, link, text, size[i], scale, maxsize) -- create the wikicode (using the respective size)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		for i, v in ipairs(image) do -- iterate over the images&lt;br /&gt;
			result = result .. imagecode(v, link, text, size, scale, maxsize) -- create the wikicode&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
---Return a string like `Internal Item ID: `, depending on the `_type`.&lt;br /&gt;
---@param _type &amp;#039;&amp;quot;item&amp;quot;&amp;#039;|&amp;#039;&amp;quot;tile&amp;quot;&amp;#039;|&amp;#039;&amp;quot;wall&amp;quot;&amp;#039;|&amp;#039;&amp;quot;npc&amp;quot;&amp;#039;|&amp;#039;&amp;quot;mount&amp;quot;&amp;#039;|&amp;#039;&amp;quot;buff&amp;quot;&amp;#039;|&amp;#039;&amp;quot;projectile&amp;quot;&amp;#039;|&amp;#039;&amp;quot;armor&amp;quot;&amp;#039;&lt;br /&gt;
---@return string&lt;br /&gt;
local function getIdText(_type)&lt;br /&gt;
	local id_text&lt;br /&gt;
	if _type == &amp;#039;item&amp;#039; then -- a shortcut for faster&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_item&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;tile&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_tile&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;wall&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_wall&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;npc&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_npc&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;mount&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_mount&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;buff&amp;#039; or _type == &amp;#039;debuff&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_buff&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;projectile&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_projectile&amp;#039;)&lt;br /&gt;
	elseif _type == &amp;#039;armor&amp;#039; then&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_armor&amp;#039;)&lt;br /&gt;
	else&lt;br /&gt;
		id_text = l10n(&amp;#039;id_text_item&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	return id_text&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-----------------------------------------------------------------&lt;br /&gt;
-- main return object&lt;br /&gt;
return {&lt;br /&gt;
&lt;br /&gt;
parse = parse,&lt;br /&gt;
go = function(frame, args)&lt;br /&gt;
	-- cache?&lt;br /&gt;
	local cache_key = args and getCacheKey(args) or (&amp;#039;:_item:&amp;#039; .. frame.args[1])&lt;br /&gt;
	local cached = cache.get(cache_key)&lt;br /&gt;
	if cached then&lt;br /&gt;
		return cached&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- init var cache&lt;br /&gt;
	currentFrame = frame&lt;br /&gt;
	args_table = args or parse(frame.args[1])&lt;br /&gt;
	lang = getArg(&amp;#039;lang&amp;#039;) or &amp;#039;en&amp;#039;&lt;br /&gt;
	l10n_table = l10n_info[lang] or l10n_info[&amp;#039;en&amp;#039;]&lt;br /&gt;
&lt;br /&gt;
	local _arg1 = getArg(1) or &amp;#039;&amp;#039;&lt;br /&gt;
	local _nolink = getArg(&amp;#039;nolink&amp;#039;)&lt;br /&gt;
	local _link = _nolink and &amp;#039;&amp;#039; or getArg(&amp;#039;link&amp;#039;) or tr.translateLink(_arg1, lang) -- now: _link == &amp;#039;&amp;#039; means nolink&lt;br /&gt;
&lt;br /&gt;
	local text = getArg(2) or &amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	-- set output flags&lt;br /&gt;
	local output_image, output_text, output_table = true, true, false&lt;br /&gt;
	local _mode = getArg(&amp;#039;mode&amp;#039;)&lt;br /&gt;
	if _mode then&lt;br /&gt;
		if _mode == &amp;#039;image&amp;#039; or _mode == &amp;#039;imageonly&amp;#039; or _mode ==&amp;#039;onlyimage&amp;#039; then&lt;br /&gt;
			output_text = false&lt;br /&gt;
		elseif _mode == &amp;#039;text&amp;#039; or _mode == &amp;#039;noimage&amp;#039; then&lt;br /&gt;
			output_image = false&lt;br /&gt;
		elseif _mode == &amp;#039;table&amp;#039; or _mode == &amp;#039;2-cell&amp;#039; then&lt;br /&gt;
			output_table = true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local hovertext&lt;br /&gt;
	if output_image and not output_text then&lt;br /&gt;
		-- with image only, the hovertext will only be displayed on the image, so it should be text or {{tr|_arg1}} or _link (in that order)&lt;br /&gt;
		if text ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			hovertext = text&lt;br /&gt;
		elseif _arg1 ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			hovertext = tr.translate(_arg1, lang)&lt;br /&gt;
		else&lt;br /&gt;
			hovertext = _link&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- with image and text, the hovertext will be displayed on the image and on the text, so it should be {{tr|_arg1}} or text or _link (in that order)&lt;br /&gt;
		if _arg1 ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			hovertext = tr.translate(_arg1, lang)&lt;br /&gt;
		elseif text ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			hovertext = text&lt;br /&gt;
		else&lt;br /&gt;
			hovertext = _link&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local class = &amp;#039;i&amp;#039;&lt;br /&gt;
&lt;br /&gt;
	local image_output, text_output&lt;br /&gt;
	-- get wikicode for the image(s)&lt;br /&gt;
	if output_image then&lt;br /&gt;
		local image_arg = getArg(&amp;#039;image&amp;#039;)&lt;br /&gt;
		if not image_arg then&lt;br /&gt;
			if _arg1 == &amp;#039;1/2 Second Timer&amp;#039; then&lt;br /&gt;
				image_arg = &amp;#039;1 2 Second Timer&amp;#039;&lt;br /&gt;
			elseif _arg1 == &amp;#039;1/4 Second Timer&amp;#039; then&lt;br /&gt;
				image_arg = &amp;#039;1 4 Second Timer&amp;#039;&lt;br /&gt;
			elseif _arg1 == &amp;#039;r/Terraria&amp;#039; then&lt;br /&gt;
				image_arg = &amp;#039;r Terraria&amp;#039;&lt;br /&gt;
			else&lt;br /&gt;
				image_arg = string.gsub(_arg1, &amp;quot;:%s*&amp;quot;, &amp;quot; &amp;quot;)&lt;br /&gt;
			end&lt;br /&gt;
			image_arg = image_arg .. &amp;#039;.&amp;#039; .. (getArg(&amp;#039;ext&amp;#039;) or &amp;#039;png&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		if string.find(image_arg, &amp;#039;%[%[[fF]ile:&amp;#039;) then&lt;br /&gt;
			image_output = &amp;#039;&amp;lt;span class=&amp;quot;img&amp;quot;&amp;gt;&amp;#039; .. image_arg .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			image_output = images(image_arg, _link, hovertext, getArg(&amp;#039;size&amp;#039;), getArg(&amp;#039;scale&amp;#039;), getArg(&amp;#039;maxsize&amp;#039;))&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		image_output = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
	-- get wikicode for the text&lt;br /&gt;
	if output_text then&lt;br /&gt;
		local _note, _note2, _bignote, _showid, _id, _icon = getArg(&amp;#039;note&amp;#039;), getArg(&amp;#039;note2&amp;#039;), getArg(&amp;#039;bignote&amp;#039;), getArg(&amp;#039;showid&amp;#039;), getArg(&amp;#039;id&amp;#039;), getArg(&amp;#039;icons&amp;#039;) -- get info from arguments&lt;br /&gt;
&lt;br /&gt;
		-- prepare: display ID?&lt;br /&gt;
		if _id and not _showid then&lt;br /&gt;
			_showid = true&lt;br /&gt;
		end&lt;br /&gt;
		if _showid and (_showid == &amp;#039;n&amp;#039; or _showid == &amp;#039;no&amp;#039;) then&lt;br /&gt;
			_showid = false&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- prepare: wrap?&lt;br /&gt;
		local _wrap&lt;br /&gt;
		if _showid or _note2 then&lt;br /&gt;
			_wrap = false&lt;br /&gt;
		else&lt;br /&gt;
			_wrap = getArg(&amp;#039;wrap&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- prepare: eicons&lt;br /&gt;
		local icon = &amp;#039;&amp;#039;&lt;br /&gt;
		if text ~= &amp;#039;&amp;#039; and _icon ~= &amp;#039;n&amp;#039; and _icon ~= &amp;#039;no&amp;#039; then -- no display text no eicons.&lt;br /&gt;
			local _small = (_showid or _note2 or _wrap or getArg(&amp;#039;small&amp;#039;)) and &amp;#039;y&amp;#039;&lt;br /&gt;
			if _icon and _icon ~= &amp;#039;y&amp;#039; and _icon ~= &amp;#039;yes&amp;#039; then&lt;br /&gt;
				-- make the size of {{eicons}} from {{{icon}}} input match {{{small}}} setting.&lt;br /&gt;
				if _small then&lt;br /&gt;
					icon = string.gsub(_icon, &amp;#039; class=&amp;quot;eico &amp;#039;, &amp;#039; class=&amp;quot;eico s &amp;#039;)&lt;br /&gt;
				else&lt;br /&gt;
					icon = string.gsub(_icon, &amp;#039; class=&amp;quot;eico s &amp;#039;, &amp;#039; class=&amp;quot;eico &amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				icon = eicons(_arg1, lang, _small)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- prepare: link and display text&lt;br /&gt;
		if _link == &amp;#039;&amp;#039; or text == &amp;#039;&amp;#039; or string.find(text, &amp;#039;%[%[.-%]%]&amp;#039;) then&lt;br /&gt;
			text = &amp;#039;&amp;lt;span title=&amp;quot;&amp;#039;..hovertext..&amp;#039;&amp;quot;&amp;gt;&amp;#039;..text..&amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			if text == _link then&lt;br /&gt;
				text = &amp;#039;&amp;lt;span&amp;gt;[[&amp;#039;..text..&amp;#039;]]&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
			else&lt;br /&gt;
				text = &amp;#039;&amp;lt;span&amp;gt;[[&amp;#039;.._link..&amp;#039;|&amp;#039;..text..&amp;#039;]]&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- assemble HTML code&lt;br /&gt;
		local content = text -- item name link text first.&lt;br /&gt;
		-- &amp;#039;-w&amp;#039; class means &amp;#039;wrapmode&amp;#039;, optimized for multiple lines of text. But it should be disabled for single line text.&lt;br /&gt;
		if _wrap then&lt;br /&gt;
			-- eicons in the same line&lt;br /&gt;
			if icon ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				class = class .. &amp;#039; -w&amp;#039;&lt;br /&gt;
				content = content .. icon&lt;br /&gt;
			end&lt;br /&gt;
			-- note in a new line&lt;br /&gt;
			if _note then&lt;br /&gt;
				class = class .. &amp;#039; -w&amp;#039;&lt;br /&gt;
				content = content .. &amp;#039;&amp;lt;span class=&amp;quot;note&amp;quot;&amp;gt;&amp;#039; .. _note .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			-- note in the same line&lt;br /&gt;
			if _note then&lt;br /&gt;
				content = content .. &amp;#039;&amp;lt;span class=&amp;quot;note&amp;quot;&amp;gt;&amp;#039; .. _note .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
			-- eicons in the same line&lt;br /&gt;
			if icon ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				content = content .. icon&lt;br /&gt;
			end&lt;br /&gt;
			-- note2 in a new line&lt;br /&gt;
			if _note2 then&lt;br /&gt;
				class = class .. &amp;#039; -w&amp;#039;&lt;br /&gt;
				content = content .. &amp;#039;&amp;lt;span class=&amp;quot;note2&amp;quot;&amp;gt;&amp;#039; .. _note2 .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
			-- id in a new line&lt;br /&gt;
			if _showid then&lt;br /&gt;
				class = class .. &amp;#039; -w&amp;#039;&lt;br /&gt;
				local idtype = (getArg(&amp;#039;type&amp;#039;) or &amp;#039;item&amp;#039;):lower()&lt;br /&gt;
				if not _id then&lt;br /&gt;
					-- get ID automatically via {{itemIdFromName}} or the like&lt;br /&gt;
					_id = frame:expandTemplate{ title = idtype .. &amp;#039;IdFromName&amp;#039;, args = {_arg1} }&lt;br /&gt;
				end&lt;br /&gt;
				local id_text = getIdText(idtype)&lt;br /&gt;
				content = content .. &amp;#039;&amp;lt;span class=&amp;quot;id&amp;quot;&amp;gt;&amp;#039; .. id_text .. _id .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		if _bignote then&lt;br /&gt;
			text_output = &amp;#039;&amp;lt;span&amp;gt;&amp;#039; .. content .. &amp;#039;&amp;lt;/span&amp;gt;&amp;lt;span&amp;gt;&amp;#039; .. _bignote .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		else&lt;br /&gt;
			text_output = &amp;#039;&amp;lt;span&amp;gt;&amp;#039; .. content .. &amp;#039;&amp;lt;/span&amp;gt;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		text_output = &amp;#039;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- handle custom CSS&lt;br /&gt;
	local _class, _css = getArg(&amp;#039;class&amp;#039;), getArg(&amp;#039;css&amp;#039;)&lt;br /&gt;
	if _class then&lt;br /&gt;
		class = class .. &amp;#039; &amp;#039; .. _class -- add to existing classes&lt;br /&gt;
	end&lt;br /&gt;
	local attr = {class = class}&lt;br /&gt;
	if _css then&lt;br /&gt;
		attr.style = _css -- set the style attribute to parameter value&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- anchor:&lt;br /&gt;
	local _anchor = getArg(&amp;#039;anchor&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	local return_string&lt;br /&gt;
	if output_table then&lt;br /&gt;
		-- table output&lt;br /&gt;
		attr.class = class&lt;br /&gt;
		local _rowspan = getArg(&amp;#039;rowspan&amp;#039;)&lt;br /&gt;
		local rowspan_text = (_rowspan and (&amp;#039; rowspan=&amp;#039; .. _rowspan) or &amp;#039;&amp;#039;)&lt;br /&gt;
		-- prepare the two cells&lt;br /&gt;
		local first_cell_pre = rowspan_text .. &amp;#039; class=&amp;quot;il1c&amp;quot;&amp;#039;&lt;br /&gt;
		local first_cell_content = mw.text.tag(&amp;#039;span&amp;#039;, attr, image_output)&lt;br /&gt;
		if _anchor then&lt;br /&gt;
			first_cell_content = _anchor .. first_cell_content&lt;br /&gt;
		end&lt;br /&gt;
		local second_cell_pre = rowspan_text .. &amp;#039; class=&amp;quot;il2c&amp;quot;&amp;#039;&lt;br /&gt;
		local second_cell_content = mw.text.tag(&amp;#039;span&amp;#039;, attr, text_output)&lt;br /&gt;
		-- combine&lt;br /&gt;
		return_string = first_cell_pre .. &amp;quot; | &amp;quot; .. first_cell_content .. &amp;quot; || &amp;quot; .. second_cell_pre .. &amp;quot; | &amp;quot; .. second_cell_content&lt;br /&gt;
	else&lt;br /&gt;
		-- non-table output (text/image)&lt;br /&gt;
		return_string = mw.text.tag(&amp;#039;span&amp;#039;, attr, _anchor and (image_output .. text_output .. _anchor) or (image_output .. text_output) )&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- cache output for reuse&lt;br /&gt;
	if should_cache then&lt;br /&gt;
		cache.set(cache_key, return_string, 3600*24) -- cache for 24 hours&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- output&lt;br /&gt;
	return return_string&lt;br /&gt;
&lt;br /&gt;
end,&lt;br /&gt;
&lt;br /&gt;
purge = function(frame)&lt;br /&gt;
	cache.delete(&amp;#039;:_item:&amp;#039; .. frame.args[1]) -- delete that cache key.&lt;br /&gt;
end,&lt;br /&gt;
&lt;br /&gt;
storeImageInfo = function(frame)&lt;br /&gt;
	currentFrame = frame&lt;br /&gt;
	local width, height = storeInfoToCargo(frame.args[1])&lt;br /&gt;
	if not width or width == 0 or not height or height == 0 then&lt;br /&gt;
		return&lt;br /&gt;
	else&lt;br /&gt;
		return frame:callParserFunction{name = &amp;quot;#dplvar:set&amp;quot;, args = { &lt;br /&gt;
			&amp;quot;_image_exist&amp;quot;, &amp;quot;1&amp;quot;,&lt;br /&gt;
			&amp;quot;_image_width&amp;quot;, width,&lt;br /&gt;
			&amp;quot;_image_height&amp;quot;, height,&lt;br /&gt;
		}}&lt;br /&gt;
	end&lt;br /&gt;
end,&lt;br /&gt;
&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>imported&gt;Merge</name></author>
	</entry>
</feed>