Module:Inventory slot: Difference between revisions

No edit summary
No edit summary
Line 114: Line 114:
mod = "Minecraft"
mod = "Minecraft"
end
end
local minecraft = mod ~= "Minecraft" or mod ~= "minecraft" or ""


local img
local img
if mod ~= "Minecraft" or mod ~= "minecraft" or "" then
if minecraft then
img = "https://minecraft.wiki/images/Invicon_" .. name .. ".png"
img = "https://minecraft.wiki/images/Invicon_" .. name .. ".png"
elseif mod then
elseif mod then
Line 135: Line 137:
local link = args.link or ''
local link = args.link or ''
if link == '' then
if link == '' then
if mod then
if minecraft then
link = i18n.modLink:gsub( '%$1', mod ):gsub( '%$2', name )
link = "https://minecraft.wiki/w/" .. name
else
else
link = i18n.modLink:gsub( '%$1', "Minecraft" ):gsub( '%$2', name )
link = i18n.modLink:gsub( '%$1', "Minecraft" ):gsub( '%$2', name )
Line 190: Line 192:
altText = altText:gsub( '&[0-9a-jl-qs-wr]', '' )
altText = altText:gsub( '&[0-9a-jl-qs-wr]', '' )
end
end
item:addClass( 'invslot-item-image' )
item:addClass( 'invslot-item-image' )
:wikitext( '[[File:', img, '|32x32px|link=', link or '', '|alt=', altText, '|', escapedTitle, ']]' )
:wikitext( '[[File:', img, '|32x32px|link=', link or '', '|alt=', altText, '|', escapedTitle, ']]' )
item:addClass( 'invslot-item-image' )
:text( mod, " ", name )
if num and num > 1 and num < 1000 then
if num and num > 1 and num < 1000 then
if link then
if link then