Module:Animate

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

function p.main(frame) local args = getArgs(frame, {   wrappers = {      'Template:Animate'    }  }) return p._main(args) end

function p._main(args) if args[1] then local size = args[2] or '' if size ~= '' then size = '|' .. size end local link = args['link'] or '' if link ~= '' then link = '|link=' .. link end local images = {} for _,image in ipairs(split(args[1], '%s*;%s*')) do     if image == '' then table.insert(images, '  ') else table.insert(images, ' ') end end images[1] = images[1]:gsub('^ ', ' ') return mw.html.create('span') :attr('class', 'animated') :wikitext(table.concat(images)) else return error('Check your input', 0) end end

function p.text(frame) local args = getArgs(frame, {   wrappers = {      'Template:Animate'    }  }) return p._text(args) end

function p._text(args) if args[1] then local result = {} for _,text in ipairs(split(args[1], '%s*;%s*')) do     if text == '' then table.insert(result, '  ') else table.insert(result, ' ' .. text .. ' ') table.insert(result, ' ' .. text .. ' ') end end result[1] = result[1]:gsub('^ ', ' ') return mw.html.create('span') :attr('class', 'animated') :wikitext(table.concat(result)) else return error('Check your input', 0) end end

return p