Minecraft Wiki
(update to the English module's prefix syntax. Use the {{{prefix}}} parameter to supply a bug tracker version prefix. {{{upcoming}} and {{{future}}} are no longer functional.)
(now using ProcessArgs so #args works)
 
(55 revisões intermediárias por 5 usuários não estão sendo mostradas)
Linha 1: Linha 1:
 
local p = {}
 
local p = {}
p.fixes = function( f )
+
function p.fixes( f )
local args = f:getParent().args
+
local args = f
  +
if f == mw.getCurrentFrame() then
  +
args = f:getParent().args
 
else
  +
f = mw.getCurrentFrame()
 
end
  +
args = require("Module:ProcessArgs").norm(args)
 
local project = args.project or 'MC'
 
local project = args.project or 'MC'
 
 
local argLen = 0
+
local argLen = #args
for i in ipairs( args ) do
 
argLen = i
 
end
 
 
 
 
local parentVersion = f:callParserFunction( '#dplvar', 'parentVersion' )
 
local parentVersion = f:callParserFunction( '#dplvar', 'parentVersion' )
Linha 32: Linha 35:
 
local issues = 0
 
local issues = 0
 
local index = {}
 
local index = {}
local i = 1
+
local simplelist = false
 
if argLen == 1 then
while i < argLen do
 
local this = args[i]
+
simplelist = true
  +
string.gsub(args[1]," ","")
if this:match( '^;' ) then
 
  +
for issueinlist in string.gmatch(args[1],"([^,]+)") do
if #section > 0 then
 
table.insert( sections, section )
+
table.insert(section, issueinlist)
section = {}
+
issues = issues + 1
end
+
end
  +
else
 
local header = mw.text.trim( this )
+
local i = 1
 
while i < argLen do
headers[#sections + 1] = headerAliases[header:lower()] or header
 
  +
local this = args[i]
else
 
local issue = tonumber( this:match( '%d+' ) )
+
if this:match( '^;' ) then
if issue then
+
if #section > 0 then
table.insert( section, issue )
+
table.insert( sections, section )
issues = issues + 1
+
section = {}
  +
end
index[issue] = i
 
 
 
local header = mw.text.trim( this )
 
headers[#sections + 1] = headerAliases[header:lower()] or header
 
elseif this:match( ',' ) then
  +
else
  +
local issue = tonumber( this:match( '%d+' ) )
 
if issue then
  +
table.insert( section, issue )
  +
issues = issues + 1
 
index[issue] = i
  +
end
 
i = i + 1
 
end
 
end
 
 
 
i = i + 1
 
i = i + 1
 
end
 
end
 
i = i + 1
 
 
end
 
end
 
if #section > 0 then
 
if #section > 0 then
Linha 68: Linha 81:
 
 
 
table.sort( section )
 
table.sort( section )
  +
if simplelist then
for _, issue in ipairs( section ) do
 
  +
table.insert(list, f:preprocess("<div class='hlist'>"))
local title = mw.text.trim( args[index[issue] + 1] or '' )
 
 
for _, issue in ipairs( section ) do
table.insert( list, '* [[' .. project .. 'bug:' .. issue .. '|' .. project:upper() .. '-' .. issue .. ']] – ' .. title )
 
  +
table.insert( list, '* [[' .. 'mojira:' .. project .. '-' .. issue .. '|' .. project:upper() .. '-' .. issue .. ']]' )
  +
end
  +
table.insert(list, f:preprocess("</div>"))
  +
else
 
for _, issue in ipairs( section ) do
  +
local title = mw.text.trim( args[index[issue] + 1] or '' )
 
table.insert( list, '* [[' .. 'mojira:' .. project .. '-' .. issue .. '|' .. project:upper() .. '-' .. issue .. ']] – ' .. title )
  +
end
 
end
 
end
 
end
 
end
   
 
local prefix = ''
-- For the sake of [[1.9]]
 
local prefix = 'Minecraft '
 
 
-- For weird versions
 
 
if args.prefix then
 
if args.prefix then
prefix = args.prefix
+
prefix = args.prefix .. ' '
 
end
 
end
 
 
Linha 86: Linha 104:
 
if arg and arg ~= '' then
 
if arg and arg ~= '' then
   
table.insert( trackerQuery, query .. ' in ("' .. minecraft .. arg:gsub( ',%s*', '","' .. minecraft ) .. '")' )
+
table.insert( trackerQuery, query .. ' in ("' .. prefix .. arg:gsub( ',%s*', '","' .. prefix ) .. '")' )
 
end
 
end
 
end
 
end
Linha 104: Linha 122:
 
end
 
end
 
text = '[https://bugs.mojang.com/issues/?jql=' .. mw.uri.encode( table.concat( trackerQuery, ' AND ' ) .. ' ORDER BY key' ) .. ' ' .. text .. ']'
 
text = '[https://bugs.mojang.com/issues/?jql=' .. mw.uri.encode( table.concat( trackerQuery, ' AND ' ) .. ' ORDER BY key' ) .. ' ' .. text .. ']'
  +
if args.feedback ~= nil and args.feedback ~= '' then
  +
text = text .. ' - [https://feedback.minecraft.net/hc/en-us/articles/' .. args.feedback .. ' Minecraft Feedback]'
  +
end
 
end
 
end
 
 
return ';' .. text .. '\n' .. table.concat( list, '\n' )
+
return ';' .. text .. '\n' .. table.concat( list, '\n' ) -- .. tostring(simplelist)
 
end
 
end
 
return p
 
return p

Edição atual tal como às 13h34min de 10 de abril de 2021

[criar | histórico | purgar]Documentação
Este module não tem documentação. Se você souber como usar este module, por favor crie.
local p = {}
function p.fixes( f )
	local args = f
	if f == mw.getCurrentFrame() then
		args = f:getParent().args
	else
		f = mw.getCurrentFrame()
	end
	args = require("Module:ProcessArgs").norm(args)
	local project = args.project or 'MC'
	
	local argLen = #args
	
	local parentVersion = f:callParserFunction( '#dplvar', 'parentVersion' )
	if parentVersion == '' then
		parentVersion = f:callParserFunction( '#var', 'title' )
	end

	local headerAliases = {
		[';old'] = ';Das versões lançadas antes da ' .. parentVersion,
		[';antigo'] = ';Das versões lançadas antes da ' .. parentVersion,
		[';dev'] = ';Das versões de desenvolvimento da ' .. parentVersion .. '',
		[';desenv'] = ';Das versões de desenvolvimento da ' .. parentVersion .. '',
		[';previous'] = ';Da versão de desenvolvimento anterior',
		[';anterior'] = ';Da versão de desenvolvimento anterior',
		[';prev'] = ';Da versão de desenvolvimento anterior',
		[';hotfix'] = ';Da versão atual, corrigido',
		[';private'] = ';Problemas Privadas',
		[';priv'] = ';Problemas Privadas',
	}
	
	local sections = {}
	local headers = {}
	local section = {}
	local issues = 0
	local index = {}
	local simplelist = false
	if argLen == 1 then
		simplelist = true
		string.gsub(args[1]," ","")
		for issueinlist in string.gmatch(args[1],"([^,]+)") do
			table.insert(section, issueinlist)
			issues = issues + 1
		end	
	else
		local i = 1
		while i < argLen do
			local this = args[i]
			if this:match( '^;' ) then
				if #section > 0 then
					table.insert( sections, section )
					section = {}
				end
				
				local header = mw.text.trim( this )
				headers[#sections + 1] = headerAliases[header:lower()] or header
			elseif this:match( ',' ) then
			else
				local issue = tonumber( this:match( '%d+' ) )
				if issue then
					table.insert( section, issue )
					issues = issues + 1
					index[issue] = i
				end
				i = i + 1
			end
			
			i = i + 1
		end
	end
	if #section > 0 then
		table.insert( sections, section )
	end
	
	local list = {}
	for i, section in ipairs( sections ) do
		local header = headers[i]
		if header and header ~= '' then
			table.insert( list, header )
		end
		
		table.sort( section )
		if simplelist then
			table.insert(list, f:preprocess("<div class='hlist'>"))
			for _, issue in ipairs( section ) do
				table.insert( list, '* [[' .. 'mojira:' .. project .. '-' .. issue .. '|' .. project:upper() .. '-' .. issue ..  ']]' )
			end
			table.insert(list, f:preprocess("</div>"))
		else
			for _, issue in ipairs( section ) do
				local title = mw.text.trim( args[index[issue] + 1] or '' )
				table.insert( list, '* [[' .. 'mojira:' .. project .. '-' .. issue .. '|' .. project:upper() .. '-' .. issue ..  ']] – ' .. title )
			end
		end
	end

	local prefix = ''
	if args.prefix then
		prefix = args.prefix .. ' '
	end
	
	local trackerQuery = {}
	local makeQuery = function( query, arg )
		if arg and arg ~= '' then

			table.insert( trackerQuery, query .. ' in ("' .. prefix .. arg:gsub( ',%s*', '","' .. prefix ) .. '")' )
		end
	end
	makeQuery( 'fixVersion', args.fixedin )
	makeQuery( 'fixVersion not', args.notfixedin )
	makeQuery( 'affectedVersion', args.affected )

	if args.otherissuescount then issues = issues + args.otherissuescount end
	
	local text = issues .. (issues == 1 and ' problema corrigido' or ' problemas corrigidos')
	if #trackerQuery > 0 then
		table.insert( trackerQuery, 'project = ' .. project:upper() )

		-- For the sake of [[1.9]]
		if not args.upcoming then
			table.insert( trackerQuery, 'resolution = Fixed' )
		end
		text = '[https://bugs.mojang.com/issues/?jql=' .. mw.uri.encode( table.concat( trackerQuery, ' AND ' ) .. ' ORDER BY key' ) .. ' ' .. text .. ']'
		if args.feedback ~= nil and args.feedback ~= '' then
			text = text .. ' - [https://feedback.minecraft.net/hc/en-us/articles/' .. args.feedback .. ' Minecraft Feedback]'
		end
	end
	
	return ';' .. text .. '\n' .. table.concat( list, '\n' ) -- .. tostring(simplelist)
end
return p