Módulo:Grid/Image list

De WikiMinecraft
Saltar a: navegación, buscar

local p = {}
function p.list( f )
	local args = f.args
	local images = f:preprocess( '{{#dpl:namespace=File|category=' .. ( args[1] or '' ) .. ' grid images|format=,%PAGE%;}}' ):sub( 1, -2 )
	
	local list = {}
	for image in mw.text.gsplit( images, ';' ) do
		local link = image:match( ' (.+)%.' )
		
		table.insert( list, '<li>[[' .. image .. ']] [[' .. link .. ']]</li>' )
	end
	
	local heading = '===' .. ( args[2] or '[[' .. args[1] .. ']]' ) .. '==='
	return heading ..
		'\n<ul style="-moz-columns:250px;-webkit-columns:250px;columns:250px;-moz-column-rule:2px inset #000;-webkit-column-rule:2px inset #000;column-rule:2px inset #000">\n' ..
		table.concat( list, '\n' ) ..
		'\n</ul>'
end
return p