Minecraft Wiki
Advertisement
[view | edit | history | purge]DocumentationJump to code ↴

This module implements {{development versions}}.

[view | edit | history | purge]The above documentation is transcluded from Module:Development versions/doc.
local p = {}
p.list = function( f )
	local version = f.args[1] or f:getParent().args[1]
	local devVersions = mw.text.trim( f:callParserFunction( '#dpl', {
		category = version .. ' snapshots',
		format = ',|%PAGE%'
	} ), '|' )
	
	local content = {}
	for v in mw.text.gsplit( devVersions, '|' ) do
		local wikitext = mw.text.trim( mw.title.new( v ):getContent() )
		if not wikitext:match( '<onlyinclude>' ) then
			wikitext = '<onlyinclude>' .. wikitext .. '</onlyinclude>'
		end
		table.insert( content, '<onlyinclude>\n=' .. v .. '=\n</onlyinclude>' .. wikitext )
	end
	content = table.concat( content, '\n' )
		:gsub( '\n(=+%s*[^=\n]+\s*=+)\n', '\n=%1=\n' )
		:gsub( '^.-<onlyinclude>', '' )
		:gsub( '</onlyinclude>.-<onlyinclude>', '' )
		:gsub( '</onlyinclude>.*$', '' )
	
	return f:preprocess( content )
end
return p
Advertisement