Module:Gallery

local p = {}

function p.create(f) local args, filename, filetype, output = f:getParent.args, "", "", {} for k,v in pairs(args) do		if type(k) == "number" and (not args.dynamic or k % 2 == 1) then filename, filetype = mw.text.trim(v), mw.text.trim(tostring(args[k + 1] or "")) output[k] = (args.prefix or "") .. filename .. "." .. (args.dynamic and filetype or args.gif and "gif" or "png") .. "|link=" .. (args.noimagelink and "" or filename).. "|" .. ((args.notext and "") or (args.count and (args.dynamic and (k + 1) / 2 or k) .. ". " or "") .. (args.noimagelink and filename or "" .. filename .. "")) else output[k] = "" end end return f:callParserFunction{name="#tag:gallery", args={table.concat(output, "\n"), class="pixel-image"}} end

return p