Module:Abilimg

local getArgs = require('Module:Arguments').getArgs local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function p._main(args) local item = args['item'] or nil local extension = args['format'] or 'png' local size = args['size'] or nil local filename = tostring(mw.title.getCurrentTitle) local gallery = args['gallery'] or nil

local file = nil local image_table = nil if gallery then gallery = tonumber(gallery) image_table = mw.html.create('table'):css( 'margin', '0 auto' ) local file_table = nil local text = nil

local i = 1

while gallery ~= i - 1 do           text = 'text'..i            file = {''} if size then table.insert(file, 5, '|'..size.."px") end file_table = mw.html.create('table'):addClass('pmutable')

if args[text] then file_table :node(                       mw.html.create('tr'):node( mw.html.create('td'):wikitext(table.concat(file, '')) )                       )                    :node(                        mw.html.create('tr'):node( mw.html.create('td'):wikitext(args[text]):css('text-align', 'center'):css('width', 'min-content'):css('word-break', 'break-word') )                       )            else file_table :node(                       mw.html.create('tr'):node( mw.html.create('td'):wikitext(table.concat(file, '')) )                       )            end

image_table:node(mw.html.create('tr'):css('display', 'inline-block'):node(mw.html.create('td'):node(file_table))) i = i+1 end

elseif item then local file2 = nil if size then file = {'"}       	file2 = {'"} else file = {'"}       	file2 = {'"} end

image_table = mw.html.create('table'):css( 'margin', '0 auto' )

image_table :node(           mw.html.create('tr'):css('display', 'inline-block'):node( mw.html.create('td'):node(                       mw.html.create('table'):addClass('pmutable'):node( mw.html.create('tr'):node(                               mw.html.create('td'):wikitext(table.concat(file, ''))                            ) ):node( mw.html.create('tr'):node(                               mw.html.create('td'):wikitext("Via Ability"):css('text-align', 'center'):css('width', 'min-content'):css('word-break', 'break-word')                            ) )                   )                )            )        :node(            mw.html.create('tr'):css('display', 'inline-block'):node( mw.html.create('td'):node(                   mw.html.create('table'):addClass('pmutable'):node( mw.html.create('tr'):node(                           mw.html.create('td'):wikitext(table.concat(file2, ''))                        ) ):node( mw.html.create('tr'):node(                           mw.html.create('td'):wikitext("Via item"):css('text-align', 'center'):css('width', 'min-content'):css('word-break', 'break-word')                        ) )               )            )        )

else file = {''}

image_table = mw.html.create('table'):css( 'float', 'right' ):css( 'margin', '0 5px' ):addClass('pmutable') if size then table.insert(file, 5, '|'..size.."px") end image_table:node(mw.html.create('tr'):node(mw.html.create('td'):wikitext(table.concat(file, '')))) end

return tostring(image_table)

end

return p