Module:GalleryUtils

local utils = {}

local function parseArgs(args) parsedArgs = {} i = 1 while args["img"..i] ~= nil do       local currentTitle = args["title"..i]        if currentTitle == nil then currentTitle = args["img"..i]       end local image = { img = args["img"..i], caption = args["caption"..i], title = currentTitle, }       parsedArgs[i] = image i = i + 1 end return parsedArgs end

local function createElm(elm) local elmText = "|-|" .. elm["title"] .. "="   elmText = elmText .. ' '   if elm["caption"] ~= nil then elmText = elmText .. ' ' .. elm["caption"] .. ' '   end return elmText .. ' \n' end

function utils.tabberGallery(frame) parsedArgs = parseArgs(frame:getParent.args) collected = "" for i=1,#parsedArgs do       collected = collected .. createElm(parsedArgs[i]) end return collected end

return utils