模块:Gallery

来自星际公民中文百科
imported>DuskFyre2021年9月2日 (四) 02:44的版本 (1 revision imported: Module Import)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
Module documentation[view][edit][history][purge]
This documentation is transcluded from 模块:Gallery/doc. Changes can be proposed in the talk page.

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 height = '120'
	local prependarg = '[[File:'
	local apprendarg = '|center|frameless|' .. 'x' .. height .. 'px]]'
	
	for key,value in pairs(args) do
	    	filearg = filearg .. '<td>' .. prependarg .. args[key] .. apprendarg .. '</td>'
	end
	
	root = mw.html.create('table')
	root
		:addClass('gallerytable')
		:tag('tr')
			:wikitext( filearg )
	
	return tostring(root)
end

return p

Debug data: