Renames and correctly declares variable 'that' instead of 'self'
This commit is contained in:
parent
af013f1951
commit
068f30c2ce
1 changed files with 12 additions and 12 deletions
|
|
@ -17,15 +17,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles) {
|
LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles) {
|
||||||
self = this;
|
var that = this;
|
||||||
return '<div class="d2h-wrapper">\n' +
|
return '<div class="d2h-wrapper">\n' +
|
||||||
diffFiles.map(function(file) {
|
diffFiles.map(function(file) {
|
||||||
|
|
||||||
var diffs;
|
var diffs;
|
||||||
if (file.blocks.length) {
|
if (file.blocks.length) {
|
||||||
diffs = self.generateFileHtml(file);
|
diffs = that.generateFileHtml(file);
|
||||||
} else {
|
} else {
|
||||||
diffs = self.generateEmptyDiff();
|
diffs = that.generateEmptyDiff();
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<div id="' + printerUtils.getHtmlId(file) + '" class="d2h-file-wrapper" data-lang="' + file.language + '">\n' +
|
return '<div id="' + printerUtils.getHtmlId(file) + '" class="d2h-file-wrapper" data-lang="' + file.language + '">\n' +
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
LineByLinePrinter.prototype.generateFileHtml = function(file) {
|
LineByLinePrinter.prototype.generateFileHtml = function(file) {
|
||||||
self = this;
|
var that = this;
|
||||||
return file.blocks.map(function(block) {
|
return file.blocks.map(function(block) {
|
||||||
|
|
||||||
var lines = '<tr>\n' +
|
var lines = '<tr>\n' +
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
var matches;
|
var matches;
|
||||||
var insertType;
|
var insertType;
|
||||||
var deleteType;
|
var deleteType;
|
||||||
var doMatching = self.config.matching === "lines" || self.config.matching === "words";
|
var doMatching = that.config.matching === "lines" || that.config.matching === "words";
|
||||||
if (doMatching) {
|
if (doMatching) {
|
||||||
matches = matcher(oldLines, newLines);
|
matches = matcher(oldLines, newLines);
|
||||||
insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
|
insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
|
||||||
|
|
@ -100,19 +100,19 @@
|
||||||
oldLine = oldLines[j];
|
oldLine = oldLines[j];
|
||||||
newLine = newLines[j];
|
newLine = newLines[j];
|
||||||
|
|
||||||
self.config.isCombined = file.isCombined;
|
that.config.isCombined = file.isCombined;
|
||||||
var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, self.config);
|
var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
|
||||||
|
|
||||||
processedOldLines +=
|
processedOldLines +=
|
||||||
self.generateLineHtml(deleteType, oldLine.oldNumber, oldLine.newNumber,
|
that.generateLineHtml(deleteType, oldLine.oldNumber, oldLine.newNumber,
|
||||||
diff.first.line, diff.first.prefix);
|
diff.first.line, diff.first.prefix);
|
||||||
processedNewLines +=
|
processedNewLines +=
|
||||||
self.generateLineHtml(insertType, newLine.oldNumber, newLine.newNumber,
|
that.generateLineHtml(insertType, newLine.oldNumber, newLine.newNumber,
|
||||||
diff.second.line, diff.second.prefix);
|
diff.second.line, diff.second.prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
lines += processedOldLines + processedNewLines;
|
lines += processedOldLines + processedNewLines;
|
||||||
lines += self.processLines(oldLines.slice(common), newLines.slice(common));
|
lines += that.processLines(oldLines.slice(common), newLines.slice(common));
|
||||||
|
|
||||||
processedOldLines = [];
|
processedOldLines = [];
|
||||||
processedNewLines = [];
|
processedNewLines = [];
|
||||||
|
|
@ -130,9 +130,9 @@
|
||||||
processChangeBlock();
|
processChangeBlock();
|
||||||
}
|
}
|
||||||
if (line.type == diffParser.LINE_TYPE.CONTEXT) {
|
if (line.type == diffParser.LINE_TYPE.CONTEXT) {
|
||||||
lines += self.generateLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
|
lines += that.generateLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
|
||||||
} else if (line.type == diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
|
} else if (line.type == diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
|
||||||
lines += self.generateLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
|
lines += that.generateLineHtml(line.type, line.oldNumber, line.newNumber, escapedLine);
|
||||||
} else if (line.type == diffParser.LINE_TYPE.DELETES) {
|
} else if (line.type == diffParser.LINE_TYPE.DELETES) {
|
||||||
oldLines.push(line);
|
oldLines.push(line);
|
||||||
} else if (line.type == diffParser.LINE_TYPE.INSERTS && !!oldLines.length) {
|
} else if (line.type == diffParser.LINE_TYPE.INSERTS && !!oldLines.length) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue