![]() |
VOOZH | about |
Use {{#invoke:fixes|fixes}} to invoke this module.
For details about the usage, see Template:Fixes.
localp={} functionp.fixes(f) localargs=require("Module:ProcessArgs").norm(f:getParent().args) localproject=args.projector'MC' localargLen=0 foriinipairs(args)do argLen=i end localparentVersion=f:callParserFunction('#dplvar','parentVersion') localparentMajorVersion=nil ifparentVersion==nilorparentVersion==''then parentVersion=f:callParserFunction('#var','title') end ifargs.veralias~=nilandargs.veralias~=''andparentVersion~=nilandparentVersion~=''then parentMajorVersion=table.concat(mw.text.split(string.gsub(parentVersion,'%s',''),'[\.]'),'.',1,2) end localheaderAliases={ [';old']=';From released versions before '..parentVersion, [';dev']=';From the '..parentVersion..' development versions', [';previous']=';From the previous development version', [';prev']=';From the previous development version', [';hotfix']=';From the current version, hotfixed', [';private']=';Private issues', [';priv']=';Private issues', } localsections={} localheaders={} localsection={} localissues=0 localindex={} locali=1 whilei<argLendo localthis=args[i] ifthis:match('^;')then if#section>0then table.insert(sections,section) section={} end localheader=mw.text.trim(this) header=headerAliases[header:lower()]orheader headers[#sections+1]="'''"..header:sub(2).."'''" else localissue=tonumber(this:match('%d+')) ifissuethen table.insert(section,issue) issues=issues+1 index[issue]=i end i=i+1 end i=i+1 end if#section>0then table.insert(sections,section) end locallist={} fori,sectioninipairs(sections)do localheader=headers[i] ifheaderandheader~=''then table.insert(list,header) end table.sort(section) for_,issueinipairs(section)do localtitle=mw.text.trim(args[index[issue]+1]or'') localinterwiki=(project=='MCCE'orproject=='MCLG')and'MojiraArchive'or'Mojira' table.insert(list,'* [['..interwiki..':'..project..'-'..issue..'|'..project:upper()..'-'..issue..']] – '..title) end end localprefix='' ifargs.prefixandargs.prefix~=''then prefix=args.prefix..' ' end localtrackerQuery={} localmakeQuery=function(query,arg) ifargandarg~=''then localmakeQuery_results={} forvinmw.text.gsplit(arg,'%s*,%s*')do localtrimmed_query=mw.text.trim(v) iftrimmed_query~=''then ifstring.lower(trimmed_query)=='future'then ifparentMajorVersion~=nilthen table.insert(makeQuery_results,'"Future Version - '..parentMajorVersion..'+"') end else table.insert(makeQuery_results,'"'..prefix..trimmed_query..'"') end end end table.insert(trackerQuery,query..' in ('..table.concat(makeQuery_results,',')..')') end end makeQuery('fixVersion',args.fixedin) makeQuery('fixVersion not',args.notfixedin) makeQuery('affectedVersion',args.affected) makeQuery('affectedVersion not',args.notaffected) localmakeMatch=function(query,arg) ifargandarg~=''then forvinmw.text.gsplit(arg,'%s*,%s*')do localtrimmed_query=mw.text.trim(v) iftrimmed_query~=''then table.insert(trackerQuery,query..' ~ "'..prefix..trimmed_query..'"') end end end end makeMatch('fixVersion',args.fixedmatch) makeMatch('not fixVersion',args.notfixedmatch) makeMatch('affectedVersion',args.affectedmatch) makeMatch('not affectedVersion',args.notaffectedmatch) ifargs.otherissuescountthenissues=issues+args.otherissuescountend localtext=issues..(issues==1and' issue'or' issues')..(args.plannedand' planned to be'or'')..' fixed' if#trackerQuery>0then table.insert(trackerQuery,'project = '..project:upper()) -- For the sake of [[1.9]] ifnotargs.upcomingthen table.insert(trackerQuery,'resolution = Fixed') end text='[https://bugs.mojang.com/browse/MC/?label='..mw.uri.encode('" OR '..table.concat(trackerQuery,' AND ')..' OR labels="')..' '..text..']' end -- Using <p> directly to ensure the template won't need an empty line after previous text. return"<p>'''"..text.."'''</p>\n"..table.concat(list,'\n') end returnp