Minecraft Wiki
Advertisement

Este módulo implementa {{development versions}}.

[ver | editar | histórico | purgar]A documentação acima é transcluída de Módulo:Development versions/doc.
local p = {}
p.list = function( f )
	local args = f:getParent().args
	local title = mw.title.getCurrentTitle().rootText
	local version = args[1] or title

	if not version:find('Edição') and not version:find('Launcher') then
		version = 'Edição Java' .. version
	end
	
	f:callParserFunction ( '#dplvar:set', 'parentVersion', version )
	
	local categories = args.categories or 'previews, test builds, builds, alphas, betas, snapshots, pre-releases, release candidates'
	local devVersions = {}
	for category in mw.text.gsplit( categories, '%s*,%s*' ) do
		table.insert( devVersions,
			f:callParserFunction( '#dpl:', {
				category =  category .. ' ' .. version,
				format = ',|%PAGE%',
				ordermethod = 'sortkey',
				debug = '1'
			} )
		)
	end
	devVersions = mw.text.trim( table.concat( devVersions ), '%s|' )
	
	if version:find('Edição Pocket') then
		local edition = ( '^Edição Pocket' ) else
		if version:find('Edição Bedrock') then
			local edition = ( '^Edição Bedrock' )
		end
	end

	local edition = version:match( '^.- Edition' )
	local content = {}
	local brokenPages = {}
	for page in mw.text.gsplit( devVersions, '|' ) do
		local devVersion = page
		if edition then
			devVersion = page:gsub( '^' .. edition, '' )
		elseif version:find('Launcher') then
			devVersion = page:gsub( 'Launcher', '' )
			devVersion = devVersion:gsub( "x", "''x''" )
			devVersion = devVersion:gsub( "''x''''x''", "''xx''" )
		end
		
		local wikitext = mw.title.new( page ):getContent()
		if wikitext:match( '<onlyinclude>' ) and wikitext:match( '</onlyinclude>' ) then
			table.insert( content, '<onlyinclude>=[[' .. page .. '|' .. devVersion .. ']]=</onlyinclude>' .. wikitext )
		else
			table.insert( brokenPages, '"[[' .. page .. ']]"' )
		end
	end
	
	if #brokenPages > 0 then
		error( mw.text.listToText( brokenPages ) .. ' faltando <onlyinclude>', 0 )
		return
	end
	
	content = table.concat( content )
		:gsub( '^.-<onlyinclude>%s*', '\n' )
		:gsub( '%s*</onlyinclude>.-<onlyinclude>%s*', '\n' )
		:gsub( '%s*</onlyinclude>.*$', '\n' )
		:gsub( '\n(=+ *[^\n]+ *=+)', '\n=%1=' )
	
	return f:preprocess( mw.text.trim( content ) )
end
return p
Advertisement