Module:Inventory slot: Difference between revisions
No edit summary |
Reverted my changes on this for now Tag: Manual revert |
||
| (39 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
local i18n = { | local i18n = { | ||
modLink = '$1:$2', | modLink = '$1:$2', | ||
moduleAliases = [[Module:Inventory slot/Aliases]], | moduleAliases = [[Module:Inventory slot/Aliases]], | ||
| Line 102: | Line 101: | ||
local description = frame.text | local description = frame.text | ||
local mod = '' | local mod = frame.mod or 'Minecraft' | ||
local name = | local name = frame.name | ||
if frame.name:match( '%.gif$' ) and frame.name:match( '%.png$' ) then | |||
name = frame.name | name = frame.name | ||
mod = | mod = '' | ||
end | end | ||
local | local minecraft = mod == "Minecraft" or mod == "minecraft" | ||
local img = frame.img | |||
if not img then | |||
if name:match( '%.gif$' ) or name:match( '%.png$' ) then | |||
img = name | |||
-- Remove file extension from name | |||
name = name:sub( 0, -5 ) | |||
elseif minecraft then | |||
img = 'Invicon ' .. name .. '.png' | |||
elseif mod then | |||
img = mod .. ' ' .. name .. '.png' | |||
else | |||
img = name | |||
end | |||
end | end | ||
| Line 137: | Line 133: | ||
local link = args.link or '' | local link = args.link or '' | ||
if link == '' then | if link == '' then | ||
link = i18n.modLink:gsub( '%$1', | link = i18n.modLink:gsub( '%$1', mod ):gsub( '%$2', name ) | ||
elseif link:lower() == 'none' then | elseif link:lower() == 'none' then | ||
link = nil | link = nil | ||
| Line 445: | Line 441: | ||
end | end | ||
return string.format( | return string.format( | ||
'[%s] | '[%s]%s,%s[%s]', | ||
frame.title or '', | frame.title or '', | ||
frame.name, | frame.name, | ||
frame.num or '', | frame.num or '', | ||