(новый параметр из английской вики) |
Нет описания правки |
||
Строка 9: | Строка 9: | ||
end |
end |
||
− | local parentVersion = f:callParserFunction( '#dplvar', ' |
+ | local parentVersion = f:callParserFunction( '#dplvar', 'Сборка для' ) |
if parentVersion == '' then |
if parentVersion == '' then |
||
− | parentVersion = f:callParserFunction( '#var', ' |
+ | parentVersion = f:callParserFunction( '#var', 'название' ) |
end |
end |
||
Версия от 16:02, 6 декабря 2019
local p = {}
p.fixes = function( f )
local args = f:getParent().args
local project = args["проект"] or 'MC'
local argLen = 0
for i in ipairs( args ) do
argLen = i
end
local parentVersion = f:callParserFunction( '#dplvar', 'Сборка для' )
if parentVersion == '' then
parentVersion = f:callParserFunction( '#var', 'название' )
end
local headerAliases = {
[';старый'] = ';Из выпущенных версий до ' .. parentVersion,
[';сним'] = ';Из выпущенных предварительных версий ' .. parentVersion,
[';пред'] = ';Из предыдущей предварительной версии',
[';гфикс'] = ';Из этой версии',
[';част'] = ';Частные проблемы'
}
local sections = {}
local headers = {}
local section = {}
local issues = 0
local index = {}
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
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
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 )
for _, issue in ipairs( section ) do
local title = mw.text.trim( args[index[issue] + 1] or '' )
table.insert( list, '* [[' .. project .. 'bug:' .. issue .. '|' .. project:upper() .. '-' .. issue .. ']] – ' .. title )
end
end
-- Для любой версии, любого издания
local minecraft = 'Minecraft '
if args["запланированное"] or args["проект"] then
minecraft = ''
end
local trackerQuery = {}
local makeQuery = function( query, arg )
if arg and arg ~= '' then
table.insert( trackerQuery, query .. ' in ("' .. minecraft .. arg:gsub( ',%s*', '","' .. minecraft ) .. '")' )
end
end
makeQuery( 'fixVersion', args["исправленов"] )
makeQuery( 'fixVersion not', args["неисправлено"] )
makeQuery( 'affectedVersion', args["постр"] )
if args["другиеошибки"] then issues = issues + args["другиеошибки"] end
local text = issues .. (issues == 1 and ' ошибка исправлена' or ' ошибок исправлено')
if #trackerQuery > 0 then
table.insert( trackerQuery, 'project = ' .. project:upper() )
-- Для любой версии, любого издания
if not args["запланированное"] 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 .. ']'
end
return ';' .. text .. '\n' .. table.concat( list, '\n' )
end
return p