Module:Gallery

From RTGame Wiki
Module documentation[view][edit][history][purge]
This documentation is transcluded from Module:Gallery/doc. Changes can be proposed in the talk page.
Module:Gallery's function main is invoked by Template:Gallery.
Module:Gallery requires Module:Arguments.

Module:Gallery is a module that implements the {{Gallery}} template. Please see the template page for usage instructions.


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

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

function p._main(args)
	local filearg = ''
	local maxwidth = '200'
	local maxheight = '113'
	local prependarg = '[[File:'
	local apprendarg = '|center|frameless|' .. maxwidth .. 'x' .. maxheight .. 'px]]'
	
	for key,value in pairs(args) do
	    	filearg = filearg .. '<td>' .. prependarg .. args[key] .. apprendarg .. '</td>'
	end
	
	root = mw.html.create('table')
	root
		:addClass('wikitable')
		:addClass('gallerytable')
		:tag('tr')
			:wikitext( filearg )
	
	return tostring(root)
end

return p