From f32c6c9f677645255ea98f04dc8c1c7a2ec21c0b Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Sat, 21 May 2016 00:33:22 +0100 Subject: [PATCH] Migrate Side-by-Side diffs to hogan.js --- src/line-by-line-printer.js | 27 ++-- src/side-by-side-printer.js | 126 ++++++++---------- src/templates/diff2html-templates.js | 14 +- src/templates/file-summary-line.mustache | 7 +- .../generic-column-line-number.mustache | 6 + ...f.mustache => generic-empty-diff.mustache} | 0 ...th.mustache => generic-file-path.mustache} | 0 ...ne-line.mustache => generic-line.mustache} | 7 +- ...pper.mustache => generic-wrapper.mustache} | 0 .../line-by-line-column-line-number.mustache | 6 - src/templates/line-by-line-numbers.mustache | 2 + src/templates/side-by-side-file-diff.mustache | 25 ++++ src/ui/css/diff2html.css | 9 +- 13 files changed, 121 insertions(+), 108 deletions(-) create mode 100644 src/templates/generic-column-line-number.mustache rename src/templates/{line-by-line-empty-diff.mustache => generic-empty-diff.mustache} (100%) rename src/templates/{line-by-line-file-path.mustache => generic-file-path.mustache} (100%) rename src/templates/{line-by-line-line.mustache => generic-line.mustache} (59%) rename src/templates/{line-by-line-wrapper.mustache => generic-wrapper.mustache} (100%) delete mode 100644 src/templates/line-by-line-column-line-number.mustache create mode 100644 src/templates/line-by-line-numbers.mustache create mode 100644 src/templates/side-by-side-file-diff.mustache diff --git a/src/line-by-line-printer.js b/src/line-by-line-printer.js index ae12ebd..9b0a2c1 100644 --- a/src/line-by-line-printer.js +++ b/src/line-by-line-printer.js @@ -13,6 +13,7 @@ var Rematch = require('./rematch.js').Rematch; var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils; + var genericTemplatesPath = 'generic'; var baseTemplatesPath = 'line-by-line'; var iconsBaseTemplatesPath = 'icon'; var tagsBaseTemplatesPath = 'tag'; @@ -23,7 +24,7 @@ LineByLinePrinter.prototype.makeFileDiffHtml = function(file, diffs) { var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, 'file-diff'); - var filePathTemplate = hoganUtils.template(baseTemplatesPath, 'file-path'); + var filePathTemplate = hoganUtils.template(genericTemplatesPath, 'file-path'); var fileIconTemplate = hoganUtils.template(iconsBaseTemplatesPath, 'file'); var fileTagTemplate = hoganUtils.template(tagsBaseTemplatesPath, printerUtils.getFileTypeIcon(file)); @@ -41,7 +42,7 @@ }; LineByLinePrinter.prototype.makeLineByLineHtmlWrapper = function(content) { - return hoganUtils.render(baseTemplatesPath, 'wrapper', {'content': content}); + return hoganUtils.render(genericTemplatesPath, 'wrapper', {'content': content}); }; LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles) { @@ -67,9 +68,11 @@ }); LineByLinePrinter.prototype.makeColumnLineNumberHtml = function(block) { - return hoganUtils.render(baseTemplatesPath, 'column-line-number', { + return hoganUtils.render(genericTemplatesPath, 'column-line-number', { diffParser: diffParser, - block: utils.escape(block.header) + blockHeader: block.header, + lineClass: 'd2h-code-linenumber', + contentClass: 'd2h-code-line' }); }; @@ -182,18 +185,24 @@ }; LineByLinePrinter.prototype.makeLineHtml = function(type, oldNumber, newNumber, content, prefix) { - return hoganUtils.render(baseTemplatesPath, 'line', + var lineNumberTemplate = hoganUtils.render(baseTemplatesPath, 'numbers', { + oldNumber: utils.valueOrEmpty(oldNumber), + newNumber: utils.valueOrEmpty(newNumber) + }); + + return hoganUtils.render(genericTemplatesPath, 'line', { type: type, - oldNumber: utils.valueOrEmpty(oldNumber), - newNumber: utils.valueOrEmpty(newNumber), + lineClass: 'd2h-code-linenumber', + contentClass: 'd2h-code-line', prefix: prefix && utils.convertWhiteSpaceToNonBreakingSpace(prefix), - content: content && utils.convertWhiteSpaceToNonBreakingSpace(content) + content: content && utils.convertWhiteSpaceToNonBreakingSpace(content), + lineNumber: lineNumberTemplate }); }; LineByLinePrinter.prototype._generateEmptyDiff = function() { - return hoganUtils.render(baseTemplatesPath, 'empty-diff', { + return hoganUtils.render(genericTemplatesPath, 'empty-diff', { diffParser: diffParser }); }; diff --git a/src/side-by-side-printer.js b/src/side-by-side-printer.js index f50f473..1f25ba0 100644 --- a/src/side-by-side-printer.js +++ b/src/side-by-side-printer.js @@ -12,6 +12,12 @@ var utils = require('./utils.js').Utils; var Rematch = require('./rematch.js').Rematch; + var hoganUtils = require('./hoganjs-utils.js').HoganJsUtils; + var genericTemplatesPath = 'generic'; + var baseTemplatesPath = 'side-by-side'; + var iconsBaseTemplatesPath = 'icon'; + var tagsBaseTemplatesPath = 'tag'; + var matcher = Rematch.rematch(function(a, b) { var amod = a.content.substr(1); var bmod = b.content.substr(1); @@ -24,59 +30,48 @@ } SideBySidePrinter.prototype.makeDiffHtml = function(file, diffs) { - return '
\n' + - '
\n' + - ' \n' + - ' ' + printerUtils.getDiffName(file) + '\n' + - ' \n' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - ' \n' + - ' \n' + - ' ' + diffs.left + - ' \n' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - ' \n' + - ' \n' + - ' ' + diffs.right + - ' \n' + - '
\n' + - '
\n' + - '
\n' + - '
\n' + - '
\n'; + var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, 'file-diff'); + var filePathTemplate = hoganUtils.template(genericTemplatesPath, 'file-path'); + var fileIconTemplate = hoganUtils.template(iconsBaseTemplatesPath, 'file'); + var fileTagTemplate = hoganUtils.template(tagsBaseTemplatesPath, printerUtils.getFileTypeIcon(file)); + + return fileDiffTemplate.render({ + file: file, + fileHtmlId: printerUtils.getHtmlId(file), + diffs: diffs, + filePath: filePathTemplate.render({ + fileDiffName: printerUtils.getDiffName(file) + }, { + fileIcon: fileIconTemplate, + fileTag: fileTagTemplate + }) + }); }; SideBySidePrinter.prototype.generateSideBySideJsonHtml = function(diffFiles) { var that = this; - return '
\n' + - diffFiles.map(function(file) { - var diffs; - if (file.blocks.length) { - diffs = that.generateSideBySideFileHtml(file); - } else { - diffs = that.generateEmptyDiff(); - } + var content = diffFiles.map(function(file) { + var diffs; + if (file.blocks.length) { + diffs = that.generateSideBySideFileHtml(file); + } else { + diffs = that.generateEmptyDiff(); + } - return that.makeDiffHtml(file, diffs); - }).join('\n') + - '
\n'; + return that.makeDiffHtml(file, diffs); + }).join('\n'); + + return hoganUtils.render(genericTemplatesPath, 'wrapper', {'content': content}); }; SideBySidePrinter.prototype.makeSideHtml = function(blockHeader) { - return '\n' + - ' \n' + - ' \n' + - '
' + blockHeader + '
\n' + - ' \n' + - '\n'; + return hoganUtils.render(genericTemplatesPath, 'column-line-number', { + diffParser: diffParser, + blockHeader: blockHeader, + lineClass: 'd2h-code-side-linenumber', + contentClass: 'd2h-code-side-line' + }); }; SideBySidePrinter.prototype.generateSideBySideFileHtml = function(file) { @@ -87,7 +82,7 @@ file.blocks.forEach(function(block) { - fileHtml.left += that.makeSideHtml(utils.escape(block.header)); + fileHtml.left += that.makeSideHtml(block.header); fileHtml.right += that.makeSideHtml(''); var oldLines = []; @@ -101,7 +96,7 @@ var comparisons = oldLines.length * newLines.length; var maxComparisons = that.config.matchingMaxComparisons || 2500; var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' || - that.config.matching === 'words'); + that.config.matching === 'words'); if (doMatching) { matches = matcher(oldLines, newLines); @@ -224,40 +219,25 @@ return fileHtml; }; - SideBySidePrinter.prototype.makeSingleLineHtml = function(type, number, htmlContent, htmlPrefix) { - return '\n' + - ' ' + number + '\n' + - ' ' + - '
' + htmlPrefix + htmlContent + '
' + - ' \n' + - ' \n'; - }; - SideBySidePrinter.prototype.generateSingleLineHtml = function(type, number, content, prefix) { - var htmlPrefix = ''; - if (prefix) { - htmlPrefix = '' + prefix + ''; - } - - var htmlContent = ''; - if (content) { - htmlContent = '' + content + ''; - } - - return this.makeSingleLineHtml(type, number, htmlContent, htmlPrefix); + return hoganUtils.render(genericTemplatesPath, 'line', + { + type: type, + lineClass: 'd2h-code-side-linenumber', + contentClass: 'd2h-code-side-line', + prefix: prefix && utils.convertWhiteSpaceToNonBreakingSpace(prefix), + content: content && utils.convertWhiteSpaceToNonBreakingSpace(content), + lineNumber: number + }); }; SideBySidePrinter.prototype.generateEmptyDiff = function() { var fileHtml = {}; fileHtml.right = ''; - fileHtml.left = '\n' + - ' ' + - '
' + - 'File without changes' + - '
' + - ' \n' + - '\n'; + fileHtml.left = hoganUtils.render(genericTemplatesPath, 'empty-diff', { + diffParser: diffParser + }); return fileHtml; }; diff --git a/src/templates/diff2html-templates.js b/src/templates/diff2html-templates.js index 1ed0580..5f27e7c 100644 --- a/src/templates/diff2html-templates.js +++ b/src/templates/diff2html-templates.js @@ -1,18 +1,20 @@ (function() { if (!!!global.browserTemplates) global.browserTemplates = {}; -var Hogan = require("hogan.js");global.browserTemplates["file-summary-line"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
  • ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.rp("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("fileName",c,p,0)));t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("addedLines",c,p,0)));t.b("");t.b(t.v(t.f("deletedLines",c,p,0)));t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
  • ");return t.fl(); },partials: {"");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.rp("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("fileName",c,p,0)));t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("addedLines",c,p,0)));t.b("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("deletedLines",c,p,0)));t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {"");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" Files changed (");t.b(t.v(t.f("filesNumber",c,p,0)));t.b(")");t.b("\n" + i);t.b(" hide");t.b("\n" + i);t.b(" show");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
      ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("files",c,p,0)));t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); +global.browserTemplates["generic-column-line-number"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b(t.t(t.f("blockHeader",c,p,0)));t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); +global.browserTemplates["generic-empty-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" File without changes");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); +global.browserTemplates["generic-file-path"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b(t.rp("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("");t.b("\n" + i);t.b(t.rp("");return t.fl(); },partials: {"");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("lineNumber",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);if(t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("prefix",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}if(t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); +global.browserTemplates["generic-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
    ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n" + i);t.b("
    ");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["icon-file-added"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["icon-file-changed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["icon-file-deleted"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["icon-file-renamed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["icon-file"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); -global.browserTemplates["line-by-line-column-line-number"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b(t.t(t.f("blockHeader",c,p,0)));t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); -global.browserTemplates["line-by-line-empty-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" File without changes");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); global.browserTemplates["line-by-line-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");return t.fl(); },partials: {}, subs: { }}); -global.browserTemplates["line-by-line-file-path"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("");t.b("\n" + i);t.b(" ");t.b(t.rp("");t.b("\n" + i);t.b(" ");t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("");t.b("\n" + i);t.b(t.rp("");return t.fl(); },partials: {"");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b(t.v(t.f("oldNumber",c,p,0)));t.b("
    ");t.b("\n" + i);t.b("
    ");t.b(t.v(t.f("newNumber",c,p,0)));t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);if(t.s(t.f("prefix",c,p,1),c,p,0,253,329,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("prefix",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}if(t.s(t.f("content",c,p,1),c,p,0,361,435,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("");t.b("\n" + i);});c.pop();}t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("");return t.fl(); },partials: {}, subs: { }}); -global.browserTemplates["line-by-line-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("
    ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n" + i);t.b("
    ");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("
    ");t.b(t.v(t.f("oldNumber",c,p,0)));t.b("
    ");t.b("\n" + i);t.b("
    ");t.b(t.v(t.f("newNumber",c,p,0)));t.b("
    ");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("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("diffs.left",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("diffs.right",c,p,0)));t.b("\n" + i);t.b(" ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");t.b("\n" + i);t.b("
    ");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("ADDED");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("CHANGED");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("DELETED");return t.fl(); },partials: {}, subs: { }}); diff --git a/src/templates/file-summary-line.mustache b/src/templates/file-summary-line.mustache index 279d3f4..bf3b8b9 100644 --- a/src/templates/file-summary-line.mustache +++ b/src/templates/file-summary-line.mustache @@ -2,8 +2,9 @@ {{>fileIcon}} {{fileName}} - - - {{addedLines}}{{deletedLines}} + + {{addedLines}} + {{deletedLines}} + diff --git a/src/templates/generic-column-line-number.mustache b/src/templates/generic-column-line-number.mustache new file mode 100644 index 0000000..181d651 --- /dev/null +++ b/src/templates/generic-column-line-number.mustache @@ -0,0 +1,6 @@ + + + +
    {{{blockHeader}}}
    + + diff --git a/src/templates/line-by-line-empty-diff.mustache b/src/templates/generic-empty-diff.mustache similarity index 100% rename from src/templates/line-by-line-empty-diff.mustache rename to src/templates/generic-empty-diff.mustache diff --git a/src/templates/line-by-line-file-path.mustache b/src/templates/generic-file-path.mustache similarity index 100% rename from src/templates/line-by-line-file-path.mustache rename to src/templates/generic-file-path.mustache diff --git a/src/templates/line-by-line-line.mustache b/src/templates/generic-line.mustache similarity index 59% rename from src/templates/line-by-line-line.mustache rename to src/templates/generic-line.mustache index 1893a24..901c655 100644 --- a/src/templates/line-by-line-line.mustache +++ b/src/templates/generic-line.mustache @@ -1,10 +1,9 @@ - -
    {{oldNumber}}
    -
    {{newNumber}}
    + + {{{lineNumber}}} -
    +
    {{#prefix}} {{{prefix}}} {{/prefix}} diff --git a/src/templates/line-by-line-wrapper.mustache b/src/templates/generic-wrapper.mustache similarity index 100% rename from src/templates/line-by-line-wrapper.mustache rename to src/templates/generic-wrapper.mustache diff --git a/src/templates/line-by-line-column-line-number.mustache b/src/templates/line-by-line-column-line-number.mustache deleted file mode 100644 index 72825ed..0000000 --- a/src/templates/line-by-line-column-line-number.mustache +++ /dev/null @@ -1,6 +0,0 @@ - - - -
    {{{blockHeader}}}
    - - diff --git a/src/templates/line-by-line-numbers.mustache b/src/templates/line-by-line-numbers.mustache new file mode 100644 index 0000000..c0ef8c6 --- /dev/null +++ b/src/templates/line-by-line-numbers.mustache @@ -0,0 +1,2 @@ +
    {{oldNumber}}
    +
    {{newNumber}}
    diff --git a/src/templates/side-by-side-file-diff.mustache b/src/templates/side-by-side-file-diff.mustache new file mode 100644 index 0000000..3f3e5d3 --- /dev/null +++ b/src/templates/side-by-side-file-diff.mustache @@ -0,0 +1,25 @@ +
    +
    + {{{filePath}}} +
    +
    +
    +
    + + + {{{diffs.left}}} + +
    +
    +
    +
    +
    + + + {{{diffs.right}}} + +
    +
    +
    +
    +
    diff --git a/src/ui/css/diff2html.css b/src/ui/css/diff2html.css index e02efe4..595826f 100644 --- a/src/ui/css/diff2html.css +++ b/src/ui/css/diff2html.css @@ -43,7 +43,7 @@ .d2h-file-name-wrapper { display: flex; align-items: center; - width: 90%; + width: 100%; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; line-height: 15px; @@ -100,16 +100,11 @@ .d2h-code-side-line { display: block; - white-space: pre; + white-space: nowrap; padding: 0 10px; height: 18px; line-height: 18px; margin-left: 50px; - /* Override HighlightJS */ - /*color: inherit;*/ - /*overflow-x: inherit;*/ - /*background: none;*/ - /* ******************** */ } .d2h-code-line del,