Module:SpriteFile: Difference between revisions
m Protected "Module:SpriteFile" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
No edit summary |
||
| Line 33: | Line 33: | ||
local width = ( args.width or args.size or default.size ) * scale | local width = ( args.width or args.size or default.size ) * scale | ||
local size = width .. 'x' .. height .. 'px' | local size = width .. 'x' .. height .. 'px' | ||
local file = args.name .. ' ' .. id .. '.png' | local file = args.name .. ' ' .. id .. '.png' | ||
| Line 48: | Line 40: | ||
end | end | ||
local sprite = mw.html.create( 'span' ):addClass( 'sprite-file' ) | local sprite = mw.html.create( 'span' ):addClass( 'sprite-file' ) | ||
local imageTitle = mw.title.new( 'Media:' .. file ) | |||
if imageTitle and not imageTitle.exists then | |||
file = 'Grid Unknown.png' | |||
end | |||
local img = '[[File:' .. file .. '|' .. size .. '|link=' .. link .. '|alt=' .. altText .. '|class=pixel-image|' .. ( args.title or '' ) .. ']]' | local img = '[[File:' .. file .. '|' .. size .. '|link=' .. link .. '|alt=' .. altText .. '|class=pixel-image|' .. ( args.title or '' ) .. ']]' | ||
sprite:node( img ) | sprite:node( img ) | ||
local styles = {} | |||
local align = args.align or default.align | local align = args.align or default.align | ||
if align ~= default.align then | if align ~= default.align then | ||