Wrap option is given for side-by-side view. To enable the same give lineFolding=true in config object
This commit is contained in:
parent
1d01d73e74
commit
02912f062a
10 changed files with 1217 additions and 559 deletions
49
dist/diff2html.css
vendored
49
dist/diff2html.css
vendored
|
|
@ -93,6 +93,15 @@
|
|||
margin-bottom: -8px;
|
||||
}
|
||||
|
||||
.d2h-wrapped-file-side-diff {
|
||||
display: inline-block;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
width: 100%;
|
||||
margin-right: -4px;
|
||||
margin-bottom: -8px;
|
||||
}
|
||||
|
||||
.d2h-code-line {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
|
|
@ -107,6 +116,14 @@
|
|||
margin-left: 50px;
|
||||
}
|
||||
|
||||
.d2h-wrapped-code-side-line {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
padding: 0 10px;
|
||||
width:720px;
|
||||
}
|
||||
|
||||
.d2h-wrapped-code-side-line del,
|
||||
.d2h-code-line del,
|
||||
.d2h-code-side-line del {
|
||||
display: inline-block;
|
||||
|
|
@ -116,6 +133,7 @@
|
|||
border-radius: 0.2em;
|
||||
}
|
||||
|
||||
.d2h-wrapped-code-side-line ins,
|
||||
.d2h-code-line ins,
|
||||
.d2h-code-side-line ins {
|
||||
display: inline-block;
|
||||
|
|
@ -142,6 +160,15 @@
|
|||
white-space: pre;
|
||||
}
|
||||
|
||||
.d2h-wrapped-code-line-ctn {
|
||||
display: inline;
|
||||
background: none;
|
||||
padding: 0;
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.line-num1 {
|
||||
box-sizing: border-box;
|
||||
float: left;
|
||||
|
|
@ -190,6 +217,22 @@
|
|||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.d2h-wrapped-code-side-linenumber {
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
width: 56px;
|
||||
padding-left: 25px;
|
||||
padding-right: 5px;
|
||||
background-color: #fff;
|
||||
color: rgba(0, 0, 0, 0.3);
|
||||
text-align: right;
|
||||
border: solid #eeeeee;
|
||||
border-width: 0 1px 0 1px;
|
||||
cursor: pointer;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/*
|
||||
* Changes Highlight
|
||||
*/
|
||||
|
|
@ -331,6 +374,8 @@
|
|||
.selecting-right td.d2h-code-linenumber *,
|
||||
.selecting-left .d2h-code-side-line,
|
||||
.selecting-left .d2h-code-side-line *,
|
||||
.selecting-left .d2h-wrapped-code-side-line,
|
||||
.selecting-left .d2h-wrapped-code-side-line *,
|
||||
.selecting-right td.d2h-code-side-linenumber,
|
||||
.selecting-right td.d2h-code-side-linenumber * {
|
||||
-webkit-touch-callout: none;
|
||||
|
|
@ -344,6 +389,8 @@
|
|||
.selecting-left .d2h-code-line *::-moz-selection,
|
||||
.selecting-right td.d2h-code-linenumber::-moz-selection,
|
||||
.selecting-left .d2h-code-side-line::-moz-selection,
|
||||
.selecting-left .d2h-wrapped-code-side-line *::-moz-selection,
|
||||
.selecting-left .d2h-wrapped-code-side-line::-moz-selection,
|
||||
.selecting-left .d2h-code-side-line *::-moz-selection,
|
||||
.selecting-right td.d2h-code-side-linenumber::-moz-selection,
|
||||
.selecting-right td.d2h-code-side-linenumber *::-moz-selection {
|
||||
|
|
@ -355,6 +402,8 @@
|
|||
.selecting-right td.d2h-code-linenumber::selection,
|
||||
.selecting-left .d2h-code-side-line::selection,
|
||||
.selecting-left .d2h-code-side-line *::selection,
|
||||
.selecting-left .d2h-wrapped-code-side-line::selection,
|
||||
.selecting-left .d2h-wrapped-code-side-line *::selection,
|
||||
.selecting-right td.d2h-code-side-linenumber::selection,
|
||||
.selecting-right td.d2h-code-side-linenumber *::selection {
|
||||
background: transparent;
|
||||
|
|
|
|||
1391
dist/diff2html.js
vendored
1391
dist/diff2html.js
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -36,7 +36,7 @@
|
|||
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/github.min.css">
|
||||
|
||||
<!-- diff2html -->
|
||||
<link rel="stylesheet" type="text/css" href="assets/diff2html.min.css">
|
||||
<link rel="stylesheet" type="text/css" href="assets/diff2html.css">
|
||||
<!-- -->
|
||||
|
||||
|
||||
|
|
@ -240,16 +240,16 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/scala.min.js"></script>
|
||||
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>-->
|
||||
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/scala.min.js"></script>-->
|
||||
|
||||
<!-- diff2html -->
|
||||
<script type="text/javascript" src="assets/diff2html.min.js"></script>
|
||||
<script type="text/javascript" src="assets/diff2html-ui.min.js"></script>
|
||||
<script type="text/javascript" src="assets/diff2html.js"></script>
|
||||
<!-- -->
|
||||
|
||||
<script type="text/javascript" src="demo.min.js"></script>
|
||||
|
||||
<script type="text/javascript" src="demo.js"></script>
|
||||
<script type="text/javascript" src="hljs.js"></script>
|
||||
<!--<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>-->
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
28
docs/demo.js
28
docs/demo.js
|
|
@ -485,7 +485,6 @@
|
|||
$(document).ready(function() {
|
||||
// Improves browser compatibility
|
||||
require('whatwg-fetch');
|
||||
|
||||
var searchParam = 'diff';
|
||||
|
||||
var $container = $('.container');
|
||||
|
|
@ -639,11 +638,26 @@ $(document).ready(function() {
|
|||
cache: 'default'
|
||||
})
|
||||
.then(function(res) {
|
||||
return res.text();
|
||||
// return res.text();
|
||||
return "diff --git a/README b/README\nindex 771ef03..1f8b36b 100644\n--- a/README\n+++ b/README\n@@ -8,16 +8,17 @@\n matchingMaxComparisons: perform at most this much comparisons for line matching a block of changes, default is 2500\n maxLineLengthHighlight: only perform diff changes highlight if lines are smaller than this, default is 10000\n templates: object with previously compiled templates to replace parts of the html\n-rawTemplates: object with raw not compiled templates to replace parts of the html\n+\n+Transpilation\n+\n+CoffeeScript 2 generates JavaScript that uses the latest, modern syntax. The runtime or browsers where you want your code to run might not support all of that syntax. In that case, we want to convert modern JavaScript into older JavaScript that will run in older versions of Node or older browsers; for example, { a } = obj into a = obj.a. This is done via transpilers like Babel, Bublé or Traceur Compiler.\n+\n+Quickstart\n+\n+From the root of your project:\n+\n+npm install --save-dev babel-core babel-preset-env\n+echo '{ \"presets\": [\"env\"] }' > .babelrc\n+coffee --compile --transpile --inline-map some-file.coffee\n For more information regarding the possible templates look into src/templates\n \n-character_length characters characterset charindex charset charsetform charsetid check checksum checksum_agg child \n-\n-choose chr chunk class cleanup clear client clob clob_base clone close cluster\t\t\n-id cluster_probability cluster_set clustering coalesce \n-\t\t\n-coercibility col collate collation collect colu colum column column_value columns columns_updated comment \n-\n-commit compact compatibility compiled complete composite_limit compound compress compute concat concat_ws \n-\n-concurrent confirm conn connec connect connect_by_iscycle connect_by_isleaf connect_by_root connect_time connection consider consistent constant constraint constraints constructor container content contents context contributors controlfile conv convert convert_tz corr corr_k corr_s corresponding corruption cos cost count count_big counted covar_pop covar_samp cpu_per_call cpu_per_session crc32 create creation critical cross cube cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime customdatum cycle data database databases datafile datafiles datalength date_add date_cache date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts day day_to_second dayname dayofmonth dayofweek dayofyear days db_role_change dbtimezone ddl deallocate declare decode decompose decrement decrypt deduplicate def defa defau defaul default defaults deferred defi defin define degrees \n";
|
||||
})
|
||||
.then(function(data) {
|
||||
var container = '#url-diff-container';
|
||||
var diff2htmlUi = new Diff2HtmlUI({diff: data});
|
||||
var container = 'url-diff-container';
|
||||
|
||||
var diffJson = Diff2Html.getJsonFromDiff(data);
|
||||
var diff2html = Diff2Html.getPrettyHtml(diffJson, {
|
||||
inputFormat: 'json',
|
||||
outputFormat: "side-by-side",
|
||||
matching: 'none',
|
||||
lineFolding: true,
|
||||
matchWordsThreshold: 1
|
||||
});
|
||||
document.getElementById(container).innerHTML = diff2html;
|
||||
var codeLines = document.getElementById(container).getElementsByClassName("d2h-code-line-ctn");
|
||||
[].forEach.call(codeLines, function(line) {
|
||||
hljs.highlightBlock(line);
|
||||
});
|
||||
// var diff2htmlUi = new Diff2HtmlUI({diff: data});
|
||||
|
||||
if (outputFormat === 'side-by-side') {
|
||||
$container.css({'width': '100%'});
|
||||
|
|
@ -676,9 +690,9 @@ $(document).ready(function() {
|
|||
|
||||
params['synchronisedScroll'] = params['synchronisedScroll'] || true;
|
||||
|
||||
diff2htmlUi.draw(container, params);
|
||||
diff2htmlUi.fileListCloseable(container, params['fileListCloseable'] || false);
|
||||
params['highlight'] && diff2htmlUi.highlightCode(container);
|
||||
// diff2htmlUi.draw(container, params);
|
||||
// diff2htmlUi.fileListCloseable(container, params['fileListCloseable'] || false);
|
||||
// params['highlight'] && diff2htmlUi.highlightCode(container);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
3
docs/hljs.js
Normal file
3
docs/hljs.js
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
var genericTemplatesPath = 'generic';
|
||||
var baseTemplatesPath = 'line-by-line';
|
||||
var wrappedTemplatesPath = 'wrapped';
|
||||
var iconsBaseTemplatesPath = 'icon';
|
||||
var tagsBaseTemplatesPath = 'tag';
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
var genericTemplatesPath = 'generic';
|
||||
var baseTemplatesPath = 'side-by-side';
|
||||
var wrappedTemplatesPath = 'wrapped';
|
||||
var iconsBaseTemplatesPath = 'icon';
|
||||
var tagsBaseTemplatesPath = 'tag';
|
||||
|
||||
|
|
@ -33,7 +34,8 @@
|
|||
}
|
||||
|
||||
SideBySidePrinter.prototype.makeDiffHtml = function(file, diffs) {
|
||||
var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, 'file-diff');
|
||||
var that = this;
|
||||
var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, (that.config.lineFolding) ? 'wrapped-file-diff' : 'file-diff');
|
||||
var filePathTemplate = hoganUtils.template(genericTemplatesPath, 'file-path');
|
||||
var fileIconTemplate = hoganUtils.template(iconsBaseTemplatesPath, 'file');
|
||||
var fileTagTemplate = hoganUtils.template(tagsBaseTemplatesPath, printerUtils.getFileTypeIcon(file));
|
||||
|
|
@ -53,15 +55,18 @@
|
|||
|
||||
SideBySidePrinter.prototype.generateSideBySideJsonHtml = function(diffFiles) {
|
||||
var that = this;
|
||||
|
||||
var lineFolding = that.config.lineFolding;
|
||||
var content = diffFiles.map(function(file) {
|
||||
var diffs;
|
||||
if (file.blocks.length) {
|
||||
diffs = that.generateSideBySideFileHtml(file);
|
||||
if(!lineFolding) {
|
||||
diffs = that.generateSideBySideFileHtml(file);
|
||||
} else {
|
||||
diffs = that.generateSideBySideWrappedFileHtml(file);
|
||||
}
|
||||
} else {
|
||||
diffs = that.generateEmptyDiff();
|
||||
}
|
||||
|
||||
return that.makeDiffHtml(file, diffs);
|
||||
}).join('\n');
|
||||
|
||||
|
|
@ -82,7 +87,6 @@
|
|||
var fileHtml = {};
|
||||
fileHtml.left = '';
|
||||
fileHtml.right = '';
|
||||
|
||||
file.blocks.forEach(function(block) {
|
||||
fileHtml.left += that.makeSideHtml(block.header);
|
||||
fileHtml.right += that.makeSideHtml('');
|
||||
|
|
@ -178,6 +182,132 @@
|
|||
|
||||
return fileHtml;
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.generateSideBySideWrappedFileHtml = function(file) {
|
||||
var that = this;
|
||||
var fileHtml = {};
|
||||
var lineFolding = that.config.lineFolding;
|
||||
fileHtml = '';
|
||||
file.blocks.forEach(function(block) {
|
||||
fileHtml += that.makeSideHtml(block.header) + that.makeSideHtml('');
|
||||
|
||||
var oldLines = [];
|
||||
var newLines = [];
|
||||
|
||||
function processChangeBlock() {
|
||||
var matches;
|
||||
var insertType;
|
||||
var deleteType;
|
||||
|
||||
var comparisons = oldLines.length * newLines.length;
|
||||
var maxComparisons = that.config.matchingMaxComparisons || 2500;
|
||||
var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
|
||||
that.config.matching === 'words');
|
||||
|
||||
if (doMatching) {
|
||||
matches = matcher(oldLines, newLines);
|
||||
insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
|
||||
deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
|
||||
} else {
|
||||
matches = [[oldLines, newLines]];
|
||||
insertType = diffParser.LINE_TYPE.INSERTS;
|
||||
deleteType = diffParser.LINE_TYPE.DELETES;
|
||||
}
|
||||
|
||||
matches.forEach(function(match) {
|
||||
oldLines = match[0];
|
||||
newLines = match[1];
|
||||
|
||||
var common = Math.min(oldLines.length, newLines.length);
|
||||
var max = Math.max(oldLines.length, newLines.length);
|
||||
|
||||
for (var j = 0; j < common; j++) {
|
||||
var oldLine = oldLines[j];
|
||||
var newLine = newLines[j];
|
||||
|
||||
that.config.isCombined = file.isCombined;
|
||||
|
||||
var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
|
||||
fileHtml += that.generateWrappedSingleLineHtml({
|
||||
isCombined: file.isCombined,
|
||||
type: deleteType,
|
||||
number: oldLine.oldNumber,
|
||||
content: diff.first.line,
|
||||
possiblePrefix: diff.first.prefix
|
||||
}, {
|
||||
isCombined: file.isCombined,
|
||||
type: insertType,
|
||||
number: newLine.newNumber,
|
||||
content: diff.second.line,
|
||||
possiblePrefix: diff.second.prefix
|
||||
});
|
||||
}
|
||||
|
||||
if (max > common) {
|
||||
var oldSlice = oldLines.slice(common);
|
||||
var newSlice = newLines.slice(common);
|
||||
|
||||
var tmpHtml = that.processWrappedLines(file.isCombined, oldSlice, newSlice);
|
||||
fileHtml += tmpHtml;
|
||||
}
|
||||
});
|
||||
oldLines = [];
|
||||
newLines = [];
|
||||
}
|
||||
|
||||
for (var i = 0; i < block.lines.length; i++) {
|
||||
var line = block.lines[i];
|
||||
var prefix = line.content[0];
|
||||
var escapedLine = utils.escape(line.content.substr(1));
|
||||
|
||||
if (line.type !== diffParser.LINE_TYPE.INSERTS &&
|
||||
(newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
|
||||
processChangeBlock();
|
||||
}
|
||||
|
||||
if (line.type === diffParser.LINE_TYPE.CONTEXT) {
|
||||
fileHtml += that.generateWrappedSingleLineHtml({
|
||||
isCombined: file.isCombined,
|
||||
type: line.type,
|
||||
number: line.oldNumber,
|
||||
content: escapedLine,
|
||||
possiblePrefix: prefix
|
||||
},{
|
||||
isCombined: file.isCombined,
|
||||
type: line.type,
|
||||
number: line.newNumber,
|
||||
content: escapedLine,
|
||||
possiblePrefix: prefix
|
||||
});
|
||||
} else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
|
||||
fileHtml += that.generateWrappedSingleLineHtml({
|
||||
isCombined: file.isCombined,
|
||||
type: diffParser.LINE_TYPE.CONTEXT,
|
||||
number: '',
|
||||
content: '',
|
||||
possiblePrefix: ''
|
||||
},{
|
||||
isCombined: file.isCombined,
|
||||
type: line.type,
|
||||
number: line.newNumber,
|
||||
content: escapedLine,
|
||||
possiblePrefix: prefix
|
||||
});
|
||||
} else if (line.type === diffParser.LINE_TYPE.DELETES) {
|
||||
oldLines.push(line);
|
||||
} else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
|
||||
newLines.push(line);
|
||||
} else {
|
||||
console.error('unknown state in html side-by-side generator');
|
||||
processChangeBlock();
|
||||
}
|
||||
}
|
||||
|
||||
processChangeBlock();
|
||||
});
|
||||
|
||||
return fileHtml;
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.processLines = function(isCombined, oldLines, newLines) {
|
||||
var that = this;
|
||||
|
|
@ -220,6 +350,80 @@
|
|||
|
||||
return fileHtml;
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.processWrappedLines = function(isCombined, oldLines, newLines) {
|
||||
var that = this;
|
||||
var fileHtml = {};
|
||||
var lineFolding = that.config.lineFolding;
|
||||
fileHtml = '';
|
||||
var maxLinesNumber = Math.max(oldLines.length, newLines.length);
|
||||
for (var i = 0; i < maxLinesNumber; i++) {
|
||||
var oldLine = oldLines[i];
|
||||
var newLine = newLines[i];
|
||||
var oldContent;
|
||||
var newContent;
|
||||
var oldPrefix;
|
||||
var newPrefix;
|
||||
|
||||
if (oldLine) {
|
||||
oldContent = utils.escape(oldLine.content.substr(1));
|
||||
oldPrefix = oldLine.content[0];
|
||||
}
|
||||
|
||||
if (newLine) {
|
||||
newContent = utils.escape(newLine.content.substr(1));
|
||||
newPrefix = newLine.content[0];
|
||||
}
|
||||
|
||||
if (oldLine && newLine) {
|
||||
fileHtml += that.generateWrappedSingleLineHtml({
|
||||
isCombined: isCombined,
|
||||
type: oldLine.type,
|
||||
number: oldLine.oldNumber,
|
||||
content: oldContent,
|
||||
possiblePrefix: oldPrefix
|
||||
},{
|
||||
isCombined: isCombined,
|
||||
type: newLine.type,
|
||||
number: newLine.newNumber,
|
||||
content: newContent,
|
||||
possiblePrefix: newPrefix
|
||||
});
|
||||
} else if (oldLine) {
|
||||
fileHtml += that.generateWrappedSingleLineHtml({
|
||||
isCombined: isCombined,
|
||||
type: oldLine.type,
|
||||
number: oldLine.oldNumber,
|
||||
content: oldContent,
|
||||
possiblePrefix: oldPrefix
|
||||
},{
|
||||
isCombined: isCombined,
|
||||
type: diffParser.LINE_TYPE.CONTEXT,
|
||||
number: '',
|
||||
content: '',
|
||||
possiblePrefix: ''
|
||||
});
|
||||
} else if (newLine) {
|
||||
fileHtml += that.generateWrappedSingleLineHtml({
|
||||
isCombined: isCombined,
|
||||
type: diffParser.LINE_TYPE.CONTEXT,
|
||||
number: '',
|
||||
content: '',
|
||||
possiblePrefix: ''
|
||||
},{
|
||||
isCombined: isCombined,
|
||||
type: newLine.type,
|
||||
number: newLine.newNumber,
|
||||
content: newContent,
|
||||
possiblePrefix: newPrefix
|
||||
});
|
||||
} else {
|
||||
console.error('How did it get here?');
|
||||
}
|
||||
}
|
||||
|
||||
return fileHtml;
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.generateSingleLineHtml = function(isCombined, type, number, content, possiblePrefix) {
|
||||
var lineWithoutPrefix = content;
|
||||
|
|
@ -241,6 +445,34 @@
|
|||
lineNumber: number
|
||||
});
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.generateFileWrappedTemplateObj = function(side) {
|
||||
var lineWithoutPrefix = side.content;
|
||||
var prefix = side.possiblePrefix;
|
||||
|
||||
if (!prefix) {
|
||||
var lineWithPrefix = printerUtils.separatePrefix(side.isCombined, side.content);
|
||||
prefix = lineWithPrefix.prefix;
|
||||
lineWithoutPrefix = lineWithPrefix.line;
|
||||
}
|
||||
return {
|
||||
type: side.type,
|
||||
lineClass: 'd2h-wrapped-code-side-linenumber',
|
||||
contentClass: 'd2h-wrapped-code-side-line',
|
||||
prefix: prefix,
|
||||
content: lineWithoutPrefix,
|
||||
lineNumber: side.number
|
||||
};
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.generateWrappedSingleLineHtml = function(left, right) { //isCombined, type, number, content, possiblePrefix) {
|
||||
var that = this;
|
||||
|
||||
return hoganUtils.render("wrapped", 'line', {
|
||||
left: that.generateFileWrappedTemplateObj(left),
|
||||
right: that.generateFileWrappedTemplateObj(right)
|
||||
});
|
||||
};
|
||||
|
||||
SideBySidePrinter.prototype.generateEmptyDiff = function() {
|
||||
var fileHtml = {};
|
||||
|
|
|
|||
|
|
@ -15,9 +15,11 @@ global.browserTemplates["icon-file"] = new Hogan.Template({code: function (c,p,i
|
|||
global.browserTemplates["line-by-line-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"");t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b("\" class=\"d2h-file-wrapper\" data-lang=\"");t.b(t.v(t.d("file.language",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-header\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-file-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["line-by-line-numbers"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"line-num1\">");t.b(t.v(t.f("oldNumber",c,p,0)));t.b("</div>");t.b("\n" + i);t.b("<div class=\"line-num2\">");t.b(t.v(t.f("newNumber",c,p,0)));t.b("</div>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["side-by-side-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"");t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b("\" class=\"d2h-file-wrapper\" data-lang=\"");t.b(t.v(t.d("file.language",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-header\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-files-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-side-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("diffs.left",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-file-side-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("diffs.right",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["side-by-side-wrapped-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"");t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b("\" class=\"d2h-file-wrapper\" data-lang=\"");t.b(t.v(t.d("file.language",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-header\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-files-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-wrapped-file-side-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["tag-file-added"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-added d2h-added-tag\">ADDED</span>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["tag-file-changed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-changed d2h-changed-tag\">CHANGED</span>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["tag-file-deleted"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-deleted d2h-deleted-tag\">DELETED</span>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["tag-file-renamed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>");return t.fl(); },partials: {}, subs: { }});
|
||||
global.browserTemplates["wrapped-line"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.d("left.lineClass",c,p,0)));t.b(" ");t.b(t.v(t.d("left.type",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("left.lineNumber",c,p,0)));t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.d("left.type",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"");t.b(t.v(t.d("left.contentClass",c,p,0)));t.b(" ");t.b(t.v(t.d("left.type",c,p,0)));t.b("\">");t.b("\n" + i);if(t.s(t.d("left.prefix",c,p,1),c,p,0,206,287,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" <span class=\"d2h-code-line-prefix\">");t.b(t.t(t.d("left.prefix",c,p,0)));t.b("</span>");t.b("\n" + i);});c.pop();}if(t.s(t.d("left.content",c,p,1),c,p,0,329,416,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" <span class=\"d2h-wrapped-code-line-ctn\">");t.b(t.t(t.d("left.content",c,p,0)));t.b("</span>");t.b("\n" + i);});c.pop();}t.b(" </div>");t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.d("right.lineClass",c,p,0)));t.b(" ");t.b(t.v(t.d("right.type",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("right.lineNumber",c,p,0)));t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.d("right.type",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"");t.b(t.v(t.d("right.contentClass",c,p,0)));t.b(" ");t.b(t.v(t.d("right.type",c,p,0)));t.b("\">");t.b("\n" + i);if(t.s(t.d("right.prefix",c,p,1),c,p,0,667,749,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" <span class=\"d2h-code-line-prefix\">");t.b(t.t(t.d("right.prefix",c,p,0)));t.b("</span>");t.b("\n" + i);});c.pop();}if(t.s(t.d("right.content",c,p,1),c,p,0,793,881,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" <span class=\"d2h-wrapped-code-line-ctn\">");t.b(t.t(t.d("right.content",c,p,0)));t.b("</span>");t.b("\n" + i);});c.pop();}t.b(" </div>");t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b("</tr>");return t.fl(); },partials: {}, subs: { }});
|
||||
module.exports = global.browserTemplates;
|
||||
})();
|
||||
})();
|
||||
16
src/templates/side-by-side-wrapped-file-diff.mustache
Normal file
16
src/templates/side-by-side-wrapped-file-diff.mustache
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<div id="{{fileHtmlId}}" class="d2h-file-wrapper" data-lang="{{file.language}}">
|
||||
<div class="d2h-file-header">
|
||||
{{{filePath}}}
|
||||
</div>
|
||||
<div class="d2h-files-diff">
|
||||
<div class="d2h-wrapped-file-side-diff">
|
||||
<div class="d2h-code-wrapper">
|
||||
<table class="d2h-diff-table">
|
||||
<tbody class="d2h-diff-tbody">
|
||||
{{{diffs}}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
28
src/templates/wrapped-line.mustache
Normal file
28
src/templates/wrapped-line.mustache
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<tr>
|
||||
<td class="{{left.lineClass}} {{left.type}}">
|
||||
{{{left.lineNumber}}}
|
||||
</td>
|
||||
<td class="{{left.type}}">
|
||||
<div class="{{left.contentClass}} {{left.type}}">
|
||||
{{#left.prefix}}
|
||||
<span class="d2h-code-line-prefix">{{{left.prefix}}}</span>
|
||||
{{/left.prefix}}
|
||||
{{#left.content}}
|
||||
<span class="d2h-wrapped-code-line-ctn">{{{left.content}}}</span>
|
||||
{{/left.content}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="{{right.lineClass}} {{right.type}}">
|
||||
{{{right.lineNumber}}}
|
||||
</td>
|
||||
<td class="{{right.type}}">
|
||||
<div class="{{right.contentClass}} {{right.type}}">
|
||||
{{#right.prefix}}
|
||||
<span class="d2h-code-line-prefix">{{{right.prefix}}}</span>
|
||||
{{/right.prefix}}
|
||||
{{#right.content}}
|
||||
<span class="d2h-wrapped-code-line-ctn">{{{right.content}}}</span>
|
||||
{{/right.content}}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
Loading…
Reference in a new issue