2016-02-21 16:46:07 +00:00
|
|
|
!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){(function(global){!function(){function Diff2Html(){}var diffParser=__webpack_require__(1).DiffParser,fileLister=__webpack_require__(3).FileListPrinter,htmlPrinter=__webpack_require__(21).HtmlPrinter;Diff2Html.prototype.getJsonFromDiff=function(diffInput){return diffParser.generateDiffJson(diffInput)},Diff2Html.prototype.getPrettyHtml=function(diffInput,config){var configOrEmpty=config||{},diffJson=diffInput;configOrEmpty.inputFormat&&"diff"!==configOrEmpty.inputFormat||(diffJson=diffParser.generateDiffJson(diffInput));var fileList="";configOrEmpty.showFiles===!0&&(fileList=fileLister.generateFileList(diffJson,configOrEmpty));var diffOutput="";return diffOutput="side-by-side"===configOrEmpty.outputFormat?htmlPrinter.generateSideBySideJsonHtml(diffJson,configOrEmpty):htmlPrinter.generateLineByLineJsonHtml(diffJson,configOrEmpty),fileList+diffOutput},Diff2Html.prototype.getPrettyHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettyHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="line-by-line",this.getPrettyHtml(diffJson,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromDiff=function(diffInput,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="diff",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffInput,configOrEmpty)},Diff2Html.prototype.getPrettySideBySideHtmlFromJson=function(diffJson,config){var configOrEmpty=config||{};return configOrEmpty.inputFormat="json",configOrEmpty.outputFormat="side-by-side",this.getPrettyHtml(diffJson,configOrEmpty)};var diffObject=new Diff2Html;module.exports.Diff2Html=diffObject,global.Diff2Html=diffObject}()}).call(exports,function(){return this}())},function(module,exports,__webpack_require__){!function(){function DiffParser(){}function getExtension(filename,language){var nameSplit=filename.split(".");return nameSplit.length>1?nameSplit[nameSplit.length-1]:language}var utils=__webpack_require__(2).Utils,LINE_TYPE={INSERTS:"d2h-ins",DELETES:"d2h-del",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change",CONTEXT:"d2h-cntx",INFO:"d2h-info"};DiffParser.prototype.LINE_TYPE=LINE_TYPE,DiffParser.prototype.generateDiffJson=function(diffInput){var files=[],currentFile=null,currentBlock=null,oldLine=null,newLine=null,saveBlock=function(){currentBlock&&(currentFile.blocks.push(currentBlock),currentBlock=null)},saveFile=function(){currentFile&¤tFile.newName&&(files.push(currentFile),currentFile=null)},startFile=function(){saveBlock(),saveFile(),currentFile={},currentFile.blocks=[],currentFile.deletedLines=0,currentFile.addedLines=0},startBlock=function(line){saveBlock();var values;(values=/^@@ -(\d+),\d+ \+(\d+),\d+ @@.*/.exec(line))?currentFile.isCombined=!1:(values=/^@@@ -(\d+),\d+ -\d+,\d+ \+(\d+),\d+ @@@.*/.exec(line))?currentFile.isCombined=!0:(values=[0,0],currentFile.isCombined=!1),oldLine=values[1],newLine=values[2],currentBlock={},currentBlock.lines=[],currentBlock.oldStartLine=oldLine,currentBlock.newStartLine=newLine,currentBlock.header=line},createLine=function(line){var currentLine={};currentLine.content=line;var newLinePrefixes=currentFile.isCombined?["+"," +"]:["+"],delLinePrefixes=currentFile.isCombined?["-"," -"]:["-"];utils.startsWith(line,newLinePrefixes)?(currentFile.addedLines++,currentLine.type=LINE_TYPE.INSERTS,currentLine.oldNumber=null,current
|
2016-02-07 14:41:06 +00:00
|
|
|
|
2016-02-21 16:46:07 +00:00
|
|
|
}return ret.join("")}function escapeHTML(s){var n=s;return n=n.replace(/&/g,"&"),n=n.replace(/</g,"<"),n=n.replace(/>/g,">"),n=n.replace(/"/g,""")}exports.__esModule=!0,exports.convertChangesToXML=convertChangesToXML},function(module){!function(){function levenshtein(a,b){if(0==a.length)return b.length;if(0==b.length)return a.length;var i,matrix=[];for(i=0;i<=b.length;i++)matrix[i]=[i];var j;for(j=0;j<=a.length;j++)matrix[0][j]=j;for(i=1;i<=b.length;i++)for(j=1;j<=a.length;j++)matrix[i][j]=b.charAt(i-1)==a.charAt(j-1)?matrix[i-1][j-1]:Math.min(matrix[i-1][j-1]+1,Math.min(matrix[i][j-1]+1,matrix[i-1][j]+1));return matrix[b.length][a.length]}var Rematch={};Rematch.arrayToString=function arrayToString(a){return"[object Array]"===Object.prototype.toString.apply(a,[])?"["+a.map(arrayToString).join(", ")+"]":a},Rematch.levenshtein=levenshtein,Rematch.distance=function(x,y){x=x.trim(),y=y.trim();var lev=levenshtein(x,y),score=lev/(x.length+y.length);return score},Rematch.rematch=function(distanceFunction){function findBestMatch(a,b,cache){var cachecount=0;for(var key in cache)cachecount++;for(var bestMatch,bestMatchDist=1/0,i=0;i<a.length;++i)for(var j=0;j<b.length;++j){var md,cacheKey=JSON.stringify([a[i],b[j]]);cache.hasOwnProperty(cacheKey)?md=cache[cacheKey]:(md=distanceFunction(a[i],b[j]),cache[cacheKey]=md),bestMatchDist>md&&(bestMatchDist=md,bestMatch={indexA:i,indexB:j,score:bestMatchDist})}return bestMatch}function group(a,b,level,cache){"undefined"==typeof cache&&(cache={});var bm=findBestMatch(a,b,cache);if(level||(level=0),!bm||a.length+b.length<3)return[[a,b]];var a1=a.slice(0,bm.indexA),b1=b.slice(0,bm.indexB),aMatch=[a[bm.indexA]],bMatch=[b[bm.indexB]],tailA=bm.indexA+1,tailB=bm.indexB+1,a2=a.slice(tailA),b2=b.slice(tailB),group1=group(a1,b1,level+1,cache),groupMatch=group(aMatch,bMatch,level+1,cache),group2=group(a2,b2,level+1,cache),result=groupMatch;return(bm.indexA>0||bm.indexB>0)&&(result=group1.concat(result)),(a.length>tailA||b.length>tailB)&&(result=result.concat(group2)),result}return group},module.exports.Rematch=Rematch}()},function(module,exports,__webpack_require__){!function(){function HtmlPrinter(){}var LineByLinePrinter=__webpack_require__(22).LineByLinePrinter,SideBySidePrinter=__webpack_require__(39).SideBySidePrinter;HtmlPrinter.prototype.generateLineByLineJsonHtml=function(diffFiles,config){var lineByLinePrinter=new LineByLinePrinter(config);return lineByLinePrinter.generateLineByLineJsonHtml(diffFiles)},HtmlPrinter.prototype.generateSideBySideJsonHtml=function(diffFiles,config){var sideBySidePrinter=new SideBySidePrinter(config);return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles)},module.exports.HtmlPrinter=new HtmlPrinter}()},function(module,exports,__webpack_require__){!function(){function LineByLinePrinter(config){this.config=config}var diffParser=__webpack_require__(1).DiffParser,printerUtils=__webpack_require__(4).PrinterUtils,utils=__webpack_require__(2).Utils,Rematch=__webpack_require__(20).Rematch,nunjucksUtils=__webpack_require__(23).NunjucksUtils,baseTemplatesPath="line-by-line";LineByLinePrinter.prototype.makeFileDiffHtml=function(file,diffs){return nunjucksUtils.render(baseTemplatesPath,"file-diff.html",{file:file,diffs:diffs})},LineByLinePrinter.prototype.makeLineByLineHtmlWrapper=function(content){return nunjucksUtils.render(baseTemplatesPath,"wrapper.html",{content:content})},LineByLinePrinter.prototype.generateLineByLineJsonHtml=function(diffFiles){var that=this,htmlDiffs=diffFiles.map(function(file){var diffs;return diffs=file.blocks.length?that._generateFileHtml(file):that._generateEmptyDiff(),that.makeFileDiffHtml(file,diffs)});return this.makeLineByLineHtmlWrapper(htmlDiffs.join("\n"))};var matcher=Rematch.rematch(function(a,b){var amod=a.content.substr(1),bmod=b.content.substr(1);return Rematch.distance(amod,bmod)});LineByLinePrinter.prototype.makeColumnLineNumberHtml=function(block){return nunjucksUtils.render(baseTemplatesPath,"column-line-number.html",{block:block})},LineByLinePrinter.prototype._generateFileHtml=function(file){var that=this;r
|
2016-01-31 18:33:33 +00:00
|
|
|
|
2016-02-21 16:46:07 +00:00
|
|
|
if(""===old)return res=new_+str.split("").join(new_)+new_,r.copySafeness(str,res);var nextIndex=str.indexOf(old);if(0===maxCount||-1===nextIndex)return str;for(var pos=0,count=0;nextIndex>-1&&(-1===maxCount||maxCount>count);)res+=str.substring(pos,nextIndex)+new_,pos=nextIndex+old.length,count++,nextIndex=str.indexOf(old,pos);return pos<str.length&&(res+=str.substring(pos)),r.copySafeness(originalStr,res)},reverse:function(val){var arr;return arr=lib.isString(val)?filters.list(val):lib.map(val,function(v){return v}),arr.reverse(),lib.isString(val)?r.copySafeness(val,arr.join("")):arr},round:function(val,precision,method){precision=precision||0;var rounder,factor=Math.pow(10,precision);return rounder="ceil"===method?Math.ceil:"floor"===method?Math.floor:Math.round,rounder(val*factor)/factor},slice:function(arr,slices,fillWith){for(var sliceLength=Math.floor(arr.length/slices),extra=arr.length%slices,offset=0,res=[],i=0;slices>i;i++){var start=offset+i*sliceLength;extra>i&&offset++;var end=offset+(i+1)*sliceLength,slice=arr.slice(start,end);fillWith&&i>=extra&&slice.push(fillWith),res.push(slice)}return res},sort:r.makeMacro(["value","reverse","case_sensitive","attribute"],[],function(arr,reverse,caseSens,attr){return arr=lib.map(arr,function(v){return v}),arr.sort(function(a,b){var x,y;return attr?(x=a[attr],y=b[attr]):(x=a,y=b),!caseSens&&lib.isString(x)&&lib.isString(y)&&(x=x.toLowerCase(),y=y.toLowerCase()),y>x?reverse?1:-1:x>y?reverse?-1:1:0}),arr}),string:function(obj){return r.copySafeness(obj,obj)},striptags:function(input,preserve_linebreaks){input=normalize(input,""),preserve_linebreaks=preserve_linebreaks||!1;var tags=/<\/?([a-z][a-z0-9]*)\b[^>]*>|<!--[\s\S]*?-->/gi,trimmedInput=filters.trim(input.replace(tags,"")),res="";return res=preserve_linebreaks?trimmedInput.replace(/^ +| +$/gm,"").replace(/ +/g," ").replace(/(\r\n)/g,"\n").replace(/\n\n\n+/g,"\n\n"):trimmedInput.replace(/\s+/gi," "),r.copySafeness(input,res)},title:function(str){str=normalize(str,"");for(var words=str.split(" "),i=0;i<words.length;i++)words[i]=filters.capitalize(words[i]);return r.copySafeness(str,words.join(" "))},trim:function(str){return r.copySafeness(str,str.replace(/^\s*|\s*$/g,""))},truncate:function(input,length,killwords,end){var orig=input;if(input=normalize(input,""),length=length||255,input.length<=length)return input;if(killwords)input=input.substring(0,length);else{var idx=input.lastIndexOf(" ",length);-1===idx&&(idx=length),input=input.substring(0,idx)}return input+=void 0!==end&&null!==end?end:"...",r.copySafeness(orig,input)},upper:function(str){return str=normalize(str,""),str.toUpperCase()},urlencode:function(obj){var enc=encodeURIComponent;if(lib.isString(obj))return enc(obj);var parts;if(lib.isArray(obj))parts=obj.map(function(item){return enc(item[0])+"="+enc(item[1])});else{parts=[];for(var k in obj)obj.hasOwnProperty(k)&&parts.push(enc(k)+"="+enc(obj[k]))}return parts.join("&")},urlize:function(str,length,nofollow){isNaN(length)&&(length=1/0);var noFollowAttr=nofollow===!0?' rel="nofollow"':"",puncRE=/^(?:\(|<|<)?(.*?)(?:\.|,|\)|\n|>)?$/,emailRE=/^[\w.!#$%&'*+\-\/=?\^`{|}~]+@[a-z\d\-]+(\.[a-z\d\-]+)+$/i,httpHttpsRE=/^https?:\/\/.*$/,wwwRE=/^www\./,tldRE=/\.(?:org|net|com)(?:\:|\/|$)/,words=str.split(/\s+/).filter(function(word){return word&&word.length}).map(function(word){var matches=word.match(puncRE),possibleUrl=matches&&matches[1]||word;return httpHttpsRE.test(possibleUrl)?'<a href="'+possibleUrl+'"'+noFollowAttr+">"+possibleUrl.substr(0,length)+"</a>":wwwRE.test(possibleUrl)?'<a href="http://'+possibleUrl+'"'+noFollowAttr+">"+possibleUrl.substr(0,length)+"</a>":emailRE.test(possibleUrl)?'<a href="mailto:'+possibleUrl+'">'+possibleUrl+"</a>":tldRE.test(possibleUrl)?'<a href="http://'+possibleUrl+'"'+noFollowAttr+">"+possibleUrl.substr(0,length)+"</a>":word});return words.join(" ")},wordcount:function(str){str=normalize(str,"");var words=str?str.match(/\w+/g):null;return words?words.length:null},"float":function(val,def){var res=parseFloat(val);return isNaN(res)?def:res},"int":function(val,def){var res=p
|