From 0662960faeea93efd4402f34af60b06e1c9ec6cd Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Sun, 12 Apr 2015 02:59:54 +0100 Subject: [PATCH] compatibility with node code --- diff2html.js | 51 ------- index.html | 8 +- lib/fakeRequire.js | 4 + lib/jsdiff.js | 101 -------------- src/diff-parser.js | 268 +++++++++++++++++++----------------- src/diff2html.js | 61 ++++++++ src/html-printer.js | 22 ++- src/line-by-line-printer.js | 220 +++++++++++++++-------------- src/printer-utils.js | 87 +++++++----- src/side-by-side-printer.js | 248 +++++++++++++++++---------------- src/utils.js | 40 ++++-- 11 files changed, 541 insertions(+), 569 deletions(-) delete mode 100644 diff2html.js create mode 100644 lib/fakeRequire.js delete mode 100644 lib/jsdiff.js create mode 100644 src/diff2html.js diff --git a/diff2html.js b/diff2html.js deleted file mode 100644 index 5bac827..0000000 --- a/diff2html.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Diff to HTML (diff2html.js) - * Author: rtfpessoa - * - * Diff commands: - * git diff - */ - -var diffParser = new DiffParser(); -var htmlPrinter = new HtmlPrinter(); - -function Diff2Html() { -} - -/* - * Generates pretty html from string diff input - */ -Diff2Html.prototype.getPrettyHtmlFromDiff = function (diffInput) { - var diffJson = diffParser.generateDiffJson(diffInput); - return htmlPrinter.generateLineByLineJsonHtml(diffJson); -}; - -/* - * Generates json object from string diff input - */ -Diff2Html.prototype.getJsonFromDiff = function (diffInput) { - return diffParser.generateDiffJson(diffInput); -}; - -/* - * Generates pretty html from a json object - */ -Diff2Html.prototype.getPrettyHtmlFromJson = function (diffJson) { - return htmlPrinter.generateLineByLineJsonHtml(diffJson); -}; - -/* - * Generates pretty side by side html from string diff input - */ -Diff2Html.prototype.getPrettySideBySideHtmlFromDiff = function (diffInput) { - var diffJson = diffParser.generateDiffJson(diffInput); - return htmlPrinter.generateSideBySideJsonHtml(diffJson); -}; - -/* - * Generates pretty side by side html from a json object - */ -Diff2Html.prototype.getPrettySideBySideHtmlFromJson = function (diffJson) { - return htmlPrinter.generateSideBySideJsonHtml(diffJson); -}; diff --git a/index.html b/index.html index ef2dbe0..1ebfe86 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,6 @@ @@ -16,8 +14,8 @@ - + @@ -25,7 +23,7 @@ - +