Module:Gallerize

From the Aadenboy Wiki
Jump to navigation Jump to search

Documentation for this module may be created at Module:Gallerize/doc

local p = {}

function trim(s)
	return s:gsub("^%s+(.-)%s-$", "%1")
end

function p.images(frame)
	local list = frame.args[1]
	if list:match(".-: *.-") then
		local build = ""
		for name, image in list:gmatch("(.-):([^,]+),?%s*") do
			build = build.."\n|-|"..trim(name).."=[[File:"..trim(image).."|center]]"
		end
		return build.."\n"
	else
		return "|-| =[[File:"..list.."]]"
	end
end

return p