Module:Sprite: Difference between revisions

Jump to navigation Jump to search
113 bytes added ,  29 May 2022
no edit summary
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 12: Line 12:
local col = tonumber(frame.args['col']) - 1
local col = tonumber(frame.args['col']) - 1
local image = frame.args['image']
local image = frame.args['image']
local imagePath = frame:callParserFunction{ name = 'filepath', args = image }
local link = frame.args['link']
local cellWidth = sheetWidth / noOfColumns
local cellWidth = sheetWidth / noOfColumns
local cellHeight = sheetHeight / noOfRows
local cellHeight = sheetHeight / noOfRows
Line 39: Line 41:
left = tostring((offsetX - cellWidth * col) * ratio) .. 'px'
left = tostring((offsetX - cellWidth * col) * ratio) .. 'px'
})
})
:wikitext(string.format('[[%s|%dpx|class=%s]]this is a test caption', image, sheetWidth * ratio, imageClass))
:tag('a')
:attr({
href = link
})
:tag('img')
:attr({
class = imageClass,
src = imagePath
})
:done()
:done()
return tostring(span)
return tostring(span)

Navigation menu