Module:Sprite: Difference between revisions

No edit summary
No edit summary
Line 19: Line 19:
local top = math.floor( pos / tiles ) * size
local top = math.floor( pos / tiles ) * size
local text = args.text or ''
local text = args.text or ''
local title = args.title
local css = args.css
local css = args.css
local styles = {}
local styles = {}
Line 44: Line 45:
if align ~= 'text-top' then
if align ~= 'text-top' then
table.insert( styles, 'vertical-align:' .. align )
table.insert( styles, 'vertical-align:' .. align )
end
if title then
title = 'title="' .. title .. '"'
end
end
if css then
if css then
Line 53: Line 57:
'class="sprite ' .. class .. '"',
'class="sprite ' .. class .. '"',
'style="' .. table.concat( styles, ';' ) .. '"',
'style="' .. table.concat( styles, ';' ) .. '"',
title,
'><br></span>'
'><br></span>'
}, ' ' )
}, ' ' )
sprite = sprite:gsub( '%s([">])', '%1' )
sprite = sprite:gsub( '%s+([">])', '%1' )
if text ~= '' then
if text ~= '' then