(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 p.fixes( f ) |
− | local args = f |
+ | local args = f |
+ | if f == mw.getCurrentFrame() then |
||
+ | args = f:getParent().args |
||
⚫ | |||
+ | f = mw.getCurrentFrame() |
||
⚫ | |||
+ | args = require("Module:ProcessArgs").norm(args) |
||
local project = args.project or 'MC' |
local project = args.project or 'MC' |
||
− | local argLen = |
+ | local argLen = #args |
⚫ | |||
⚫ | |||
⚫ | |||
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 |
+ | local simplelist = false |
⚫ | |||
⚫ | |||
− | + | 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 |
|
⚫ | |||
⚫ | |||
+ | local this = args[i] |
||
⚫ | |||
− | + | if this:match( '^;' ) then |
|
− | if |
+ | if #section > 0 then |
− | table.insert( |
+ | table.insert( sections, section ) |
− | + | section = {} |
|
+ | end |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | else |
||
+ | local issue = tonumber( this:match( '%d+' ) ) |
||
⚫ | |||
+ | table.insert( section, issue ) |
||
+ | issues = issues + 1 |
||
⚫ | |||
+ | end |
||
⚫ | |||
end |
end |
||
i = i + 1 |
i = i + 1 |
||
end |
end |
||
− | |||
⚫ | |||
end |
end |
||
if #section > 0 then |
if #section > 0 then |
||
Linha 68: | Linha 81: | ||
table.sort( section ) |
table.sort( section ) |
||
+ | if simplelist then |
||
⚫ | |||
+ | table.insert(list, f:preprocess("<div class='hlist'>")) |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | table.insert( list, '* [[' .. 'mojira:' .. project .. '-' .. issue .. '|' .. project:upper() .. '-' .. issue .. ']]' ) |
||
+ | end |
||
+ | table.insert(list, f:preprocess("</div>")) |
||
+ | else |
||
⚫ | |||
+ | local title = mw.text.trim( args[index[issue] + 1] or '' ) |
||
⚫ | |||
+ | end |
||
end |
end |
||
end |
end |
||
⚫ | |||
− | -- For the sake of [[1.9]] |
||
⚫ | |||
− | |||
− | -- 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 ("' .. |
+ | 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
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