Module:SpriteFile: Difference between revisions
Jump to navigation
Jump to search
Set sprite file extension to jpg if used on Dungeons2AchievementSprite
No edit summary |
(Set sprite file extension to jpg if used on Dungeons2AchievementSprite) |
||
| Line 15: | Line 15: | ||
align = 'text-top' | align = 'text-top' | ||
} | } | ||
local id = mw.text.trim( tostring( args[1] or '' ) ) | local id = mw.text.trim( tostring( args[1] or '' ) ) | ||
if not args.keepcase then | if not args.keepcase then | ||
id = mw.ustring.lower( id ):gsub( '[%s%+]', '-' ) | id = mw.ustring.lower( id ):gsub( '[%s%+]', '-' ) | ||
end | |||
end | |||
local link = ( args.link or '' ) | local link = ( args.link or '' ) | ||
if mw.ustring.lower( link ) == 'none' then | if mw.ustring.lower( link ) == 'none' then | ||
| Line 45: | Line 26: | ||
elseif link ~= '' then | elseif link ~= '' then | ||
local linkPrefix = ( not link:find( '//' ) and args.linkprefix ) or '' | local linkPrefix = ( not link:find( '//' ) and args.linkprefix ) or '' | ||
link = linkPrefix .. link | link = linkPrefix .. link | ||
end | end | ||
local scale = args.scale or default.scale | local scale = args.scale or default.scale | ||
| Line 72: | Line 42: | ||
end | end | ||
local name = args.name | local name = args.name or '' | ||
if name == 'InvSprite' then | if name == 'InvSprite' then | ||
name = 'Invicon' | name = 'Invicon' | ||
end | end | ||
local extension = name == 'Dungeons2AchievementSprite' and '.jpg' or name == '' and '' or '.png' | |||
local file = | local file = name .. ' ' .. id .. extension | ||
local altText = | local altText = '' | ||
if link | if link == '' then | ||
altText = | altText = file .. ': Sprite image for ' .. id .. ' in Minecraft' | ||
end | end | ||
if id == '' then | if id == '' then | ||
| Line 113: | Line 83: | ||
spriteText = '[' .. link .. ' ' .. tostring( spriteText ) .. ']' | spriteText = '[' .. link .. ' ' .. tostring( spriteText ) .. ']' | ||
else | else | ||
spriteText = '[[' .. link .. '|' .. tostring( spriteText ) .. ']]' | |||
end | end | ||
end | end | ||