diff2html/diff2html.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-08-29 21:23:24 +00:00
/*
*
2014-08-30 02:54:52 +00:00
* Diff to HTML (diff2html.js)
2014-08-29 21:23:24 +00:00
* Author: rtfpessoa
*
2015-04-11 20:48:55 +00:00
* Diff commands:
2014-09-27 00:29:32 +00:00
* git diff
2014-08-29 21:23:24 +00:00
*/
2015-04-11 23:09:05 +00:00
var diffParser = new DiffParser();
var htmlPrinter = new HtmlPrinter();
2014-08-30 02:54:52 +00:00
2015-04-11 20:48:55 +00:00
function Diff2Html() {
}
2014-08-30 02:54:52 +00:00
2015-04-11 20:48:55 +00:00
/*
* Generates pretty html from string diff input
*/
Diff2Html.prototype.getPrettyHtmlFromDiff = function (diffInput) {
2015-04-11 23:09:05 +00:00
var diffJson = diffParser.generateDiffJson(diffInput);
return htmlPrinter.generateJsonHtml(diffJson);
2015-04-11 20:48:55 +00:00
};
/*
* Generates json object from string diff input
*/
Diff2Html.prototype.getJsonFromDiff = function (diffInput) {
2015-04-11 23:09:05 +00:00
return diffParser.generateDiffJson(diffInput);
2015-04-11 20:48:55 +00:00
};
/*
* Generates pretty html from a json object
*/
Diff2Html.prototype.getPrettyHtmlFromJson = function (diffJson) {
2015-04-11 23:09:05 +00:00
return htmlPrinter.generateJsonHtml(diffJson);
2015-04-11 20:48:55 +00:00
};
/*
* Generates pretty side by side html from string diff input
*/
Diff2Html.prototype.getPrettySideBySideHtmlFromDiff = function (diffInput) {
2015-04-11 23:09:05 +00:00
var diffJson = diffParser.generateDiffJson(diffInput);
return htmlPrinter.generateSideBySideJsonHtml(diffJson);
2015-04-11 20:48:55 +00:00
};
2014-08-30 02:54:52 +00:00
2015-04-11 20:48:55 +00:00
/*
* Generates pretty side by side html from a json object
*/
Diff2Html.prototype.getPrettySideBySideHtmlFromJson = function (diffJson) {
2015-04-11 23:09:05 +00:00
return htmlPrinter.generateSideBySideJsonHtml(diffJson);
2015-04-11 20:48:55 +00:00
};