Module:Inventory slot: Difference between revisions
m 1 revision imported |
No edit summary |
||
| Line 3: | Line 3: | ||
local i18n = { | local i18n = { | ||
filename = 'Invicon $1', | filename = 'Invicon $1', | ||
modLink = '$1:$2', | |||
modLink = ' | |||
moduleAliases = [[Module:Inventory slot/Aliases]], | moduleAliases = [[Module:Inventory slot/Aliases]], | ||
moduleRandom = [[Module:Random]], | moduleRandom = [[Module:Random]], | ||
| Line 100: | Line 99: | ||
local category | local category | ||
local title = frame.title or mw.text.trim( args.title or '' ) | local title = frame.title or mw.text.trim( args.title or '' ) | ||
local num = frame.num | local num = frame.num | ||
local description = frame.text | local description = frame.text | ||
local mod = '' | |||
local name = '' | |||
local separator = string.find(frame.name, ":") | |||
if separator then | |||
mod = string.sub(frame.name, 1, separator) | |||
name = string.sub(separator + 1) | |||
else | |||
name = frame.name | |||
mod = "Minecraft" | |||
end | |||
local img | local img | ||
if mod then | if mod ~= "Minecraft" or mod ~= "minecraft" or "" then | ||
img = i18n. | img = "https://minecraft.wiki/images/Invicon_" .. name .. ".png" | ||
elseif mod then | |||
img = i18n.filename:gsub( '%$1', name .. ' (' .. mod .. ')' ) | |||
elseif name:match( '%.gif$' ) or name:match( '%.png$' ) then | elseif name:match( '%.gif$' ) or name:match( '%.png$' ) then | ||
img = i18n.filename:gsub( '%$1', name ) | img = i18n.filename:gsub( '%$1', name ) | ||
| Line 126: | Line 138: | ||
link = i18n.modLink:gsub( '%$1', mod ):gsub( '%$2', name ) | link = i18n.modLink:gsub( '%$1', mod ):gsub( '%$2', name ) | ||
else | else | ||
link = | link = i18n.modLink:gsub( '%$1', "Minecraft" ):gsub( '%$2', name ) | ||
end | end | ||
elseif link:lower() == 'none' then | elseif link:lower() == 'none' then | ||