Module:Development versions

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('Edition') and not version:find('Launcher') then version = 'Java Edition ' .. version end f:callParserFunction ( '#dplvar:set', 'parentVersion', version ) local categories = args.categories or 'previews, test builds, builds, alphas, betas, experimental snapshots, snapshots, pre-releases, release candidates' local devVersions = {} for category in mw.text.gsplit( categories, '%s*,%s*' ) do		table.insert( devVersions,			f:callParserFunction( '#dpl:', { category = version .. ' ' .. category, format = ',|%PAGE%', ordermethod = 'sortkey', debug = '1' } )		)	end devVersions = mw.text.trim( table.concat( devVersions ), '%s|' ) local edition = version:match( '^.- Edition' ) local pageSet = {} local content = {} local brokenPages = {} for page in mw.text.gsplit( devVersions, '|' ) do		if not pageSet[page] then pageSet[page] = true 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( "xx", "xx" ) end local wikitext = mw.title.new( page ) if not wikitext then return end wikitext = wikitext:getContent if wikitext:match( ' ' ) and wikitext:match( ' ' ) then table.insert( content, ' =' .. devVersion .. '= ' .. wikitext ) else table.insert( brokenPages, '"' .. page .. '"' ) end end end if #brokenPages > 0 then error( mw.text.listToText( brokenPages ) .. ' missing ', 0 ) return end content = table.concat( content ) :gsub( '^.- %s*', '\n' ) :gsub( '%s* .- %s*', '\n' ) :gsub( '%s* .*$', '\n' ) :gsub( '\n(=+ *[^\n]+ *=+)', '\n=%1=' ) return f:preprocess( mw.text.trim( content ) ) end return p