Difference between revisions of "Module:Grid/Image list"

From CelesTek Wiki
Jump to: navigation, search
(Created page with "local p = {} function p.list( f ) local args = f.args local images = mw.text.trim( f:callParserFunction( '#dpl', { allowcachedresults = 'true', namespace = 'File', cat...")
 
(No difference)

Latest revision as of 11:22, 24 April 2015

Documentation for this module may be created at Module:Grid/Image list/doc

local p = {}
function p.list( f )
	local args = f.args
	local images = mw.text.trim( f:callParserFunction( '#dpl', {
		allowcachedresults = 'true',
		namespace = 'File',
		category = ( args[1] or '' ) .. ' grid images',
		format = ',File:%TITLE%;'
	} ), ';' )
	
	local list = {}
	for image in mw.text.gsplit( images, ';' ) do
		local link = image:match( ' (.+)%.' )
		
		table.insert( list, '<li>[[' .. image .. ']] [[' .. link .. ']]</li>' )
	end
	
	return '===' .. ( args[2] or '[[' .. args[1] .. ']]' ) .. '===' ..
		'\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