Module:Infobox: Difference between revisions

No edit summary
No edit summary
Line 19: Line 19:
local image, num = k:match( '^(image)(%d+)$' )
local image, num = k:match( '^(image)(%d+)$' )
local invImage, invNum = k:match( '^(invimage)(%d+)$' )
local invImage, invNum = k:match( '^(invimage)(%d+)$' )
if image then
if v:lower() ~= 'none' then
table.insert( imgCount, tonumber( num ) )
if image then
elseif invImage then
table.insert( imgCount, tonumber( num ) )
table.insert( invImgCount, tonumber( invNum ) )
elseif invImage then
table.insert( invImgCount, tonumber( invNum ) )
end
end
end
end
end
Line 32: Line 34:
local size = args['image' .. v .. 'size'] or defaultImageSize
local size = args['image' .. v .. 'size'] or defaultImageSize
if image ~= 'none' then
if image == 'title' then
if image == 'title' then
local imageTitle = mw.title.new( 'File:' .. title .. '.png' )
local imageTitle = mw.title.new( 'File:' .. title .. '.png' )
if imageTitle and imageTitle.exists then
if imageTitle and imageTitle.exists then
image = '[[File:' .. title .. '.png|' .. size .. ']]'
image = '[[File:' .. title .. '.png|' .. size .. ']]'
else
image = '[[File:No image.svg|' .. size .. '|link=File:' .. image .. '|Upload this image]]'
end
elseif image:match( ';' ) then
if not animate then
animate = require( 'Module:Animate' ).animate
end
image = animate{ image, size }
else
else
image = '[[File:' .. image .. '|' .. size .. ']]'
image = '[[File:No image.svg|' .. size .. '|link=File:' .. image .. '|Upload this image]]'
end
end
elseif image:match( ';' ) then
table.insert( images, '<div>' .. image .. '</div>' )
if not animate then
animate = require( 'Module:Animate' ).animate
end
image = animate{ image, size }
else
image = '[[File:' .. image .. '|' .. size .. ']]'
end
end
table.insert( images, '<div>' .. image .. '</div>' )
end
end
images = table.concat( images, '\n' )
images = table.concat( images, '\n' )