Prepare for nunjucks release
This commit is contained in:
parent
7638fbba52
commit
adc4b629c1
16 changed files with 54 additions and 68 deletions
|
|
@ -19,3 +19,5 @@ Nuno Teixeira, [@nmatpt](https://github.com/nmatpt)
|
|||
Mikko Rantanen, [@Rantanen](https://github.com/Rantanen)
|
||||
|
||||
Wolfgang Illmeyer, [@escitalopram](https://github.com/escitalopram)
|
||||
|
||||
Jameskmonger, [@Jameskmonger](https://github.com/Jameskmonger)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "diff2html",
|
||||
"version": "1.3.2",
|
||||
"version": "2.0.0-beta1",
|
||||
"homepage": "http://rtfpessoa.github.io/diff2html/",
|
||||
"description": "Fast Diff to colorized HTML",
|
||||
"keywords": [
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
"url": "git://github.com/rtfpessoa/diff2html.git"
|
||||
},
|
||||
"main": [
|
||||
"./dist/diff2html-templates.js",
|
||||
"./dist/diff2html.js",
|
||||
"./dist/diff2html-ui.js",
|
||||
"./dist/diff2html.css"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ test:
|
|||
override:
|
||||
- nvm install 0.12 && npm test
|
||||
- nvm install 4 && npm test
|
||||
- nvm install 5 && npm test
|
||||
post:
|
||||
- npm install
|
||||
- istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec
|
||||
|
|
|
|||
17
dist/diff2html-ui.js
vendored
17
dist/diff2html-ui.js
vendored
|
|
@ -114,8 +114,6 @@
|
|||
|
||||
var languages = that._getLanguages($target);
|
||||
|
||||
console.log(languages);
|
||||
|
||||
// pass the languages to the highlightjs plugin
|
||||
hljs.configure({languages: languages});
|
||||
|
||||
|
|
@ -146,18 +144,13 @@
|
|||
return line.language;
|
||||
});
|
||||
} else {
|
||||
console.log($target.find(".d2h-file-wrapper"));
|
||||
$target.find(".d2h-file-wrapper").map(function(i, file) {
|
||||
allFileLanguages.push($(file).data("lang"));
|
||||
});
|
||||
}
|
||||
|
||||
// remove duplicated languages
|
||||
var distinctLanguages = allFileLanguages.filter(function(v, i) {
|
||||
return allFileLanguages.indexOf(v) === i;
|
||||
});
|
||||
|
||||
return distinctLanguages;
|
||||
// return only distinct languages
|
||||
return this._distinct(allFileLanguages);
|
||||
};
|
||||
|
||||
Diff2HtmlUI.prototype._getHashTag = function() {
|
||||
|
|
@ -172,6 +165,12 @@
|
|||
return hashTag;
|
||||
};
|
||||
|
||||
Diff2HtmlUI.prototype._distinct = function(collection) {
|
||||
return collection.filter(function(v, i) {
|
||||
return collection.indexOf(v) === i;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.Diff2HtmlUI = Diff2HtmlUI;
|
||||
|
||||
// Expose diff2html in the browser
|
||||
|
|
|
|||
2
dist/diff2html-ui.min.js
vendored
2
dist/diff2html-ui.min.js
vendored
|
|
@ -1 +1 @@
|
|||
!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports){(function(global){!function(){function Diff2HtmlUI(config){var cfg=config||{};cfg.diff?diffJson=Diff2Html.getJsonFromDiff(cfg.diff):cfg.json&&(diffJson=cfg.json)}var diffJson=null,defaultTarget="body";Diff2HtmlUI.prototype.draw=function(targetId,config){var cfg=config||{},$target=this._getTarget(targetId);$target.html(Diff2Html.getPrettyHtml(diffJson,cfg))},Diff2HtmlUI.prototype.fileListCloseable=function(targetId,startVisible){function show(){$showBtn.hide(),$hideBtn.show(),$fileList.show()}function hide(){$hideBtn.hide(),$showBtn.show(),$fileList.hide()}var $target=this._getTarget(targetId),hashTag=this._getHashTag(),$showBtn=$target.find(".d2h-show"),$hideBtn=$target.find(".d2h-hide"),$fileList=$target.find(".d2h-file-list");"files-summary-show"===hashTag?show():"files-summary-hide"===hashTag?hide():startVisible?show():hide(),$showBtn.click(show),$hideBtn.click(hide)},Diff2HtmlUI.prototype.highlightCode=function(targetId){var that=this,$target=that._getTarget(targetId),languages=that._getLanguages($target);console.log(languages),hljs.configure({languages:languages});var $codeLines=$target.find(".d2h-code-line-ctn");$codeLines.map(function(i,line){hljs.highlightBlock(line)})},Diff2HtmlUI.prototype._getTarget=function(targetId){var $target;return $target=$(targetId?targetId:defaultTarget)},Diff2HtmlUI.prototype._getLanguages=function($target){var allFileLanguages=[];diffJson?allFileLanguages=diffJson.map(function(line){return line.language}):(console.log($target.find(".d2h-file-wrapper")),$target.find(".d2h-file-wrapper").map(function(i,file){allFileLanguages.push($(file).data("lang"))}));var distinctLanguages=allFileLanguages.filter(function(v,i){return allFileLanguages.indexOf(v)===i});return distinctLanguages},Diff2HtmlUI.prototype._getHashTag=function(){var docUrl=document.URL,hashTagIndex=docUrl.indexOf("#"),hashTag=null;return-1!=hashTagIndex&&(hashTag=docUrl.substr(hashTagIndex+1)),hashTag},module.exports.Diff2HtmlUI=Diff2HtmlUI,global.Diff2HtmlUI=Diff2HtmlUI}()}).call(exports,function(){return this}())}]);
|
||||
!function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports){(function(global){!function(){function Diff2HtmlUI(config){var cfg=config||{};cfg.diff?diffJson=Diff2Html.getJsonFromDiff(cfg.diff):cfg.json&&(diffJson=cfg.json)}var diffJson=null,defaultTarget="body";Diff2HtmlUI.prototype.draw=function(targetId,config){var cfg=config||{},$target=this._getTarget(targetId);$target.html(Diff2Html.getPrettyHtml(diffJson,cfg))},Diff2HtmlUI.prototype.fileListCloseable=function(targetId,startVisible){function show(){$showBtn.hide(),$hideBtn.show(),$fileList.show()}function hide(){$hideBtn.hide(),$showBtn.show(),$fileList.hide()}var $target=this._getTarget(targetId),hashTag=this._getHashTag(),$showBtn=$target.find(".d2h-show"),$hideBtn=$target.find(".d2h-hide"),$fileList=$target.find(".d2h-file-list");"files-summary-show"===hashTag?show():"files-summary-hide"===hashTag?hide():startVisible?show():hide(),$showBtn.click(show),$hideBtn.click(hide)},Diff2HtmlUI.prototype.highlightCode=function(targetId){var that=this,$target=that._getTarget(targetId),languages=that._getLanguages($target);hljs.configure({languages:languages});var $codeLines=$target.find(".d2h-code-line-ctn");$codeLines.map(function(i,line){hljs.highlightBlock(line)})},Diff2HtmlUI.prototype._getTarget=function(targetId){var $target;return $target=$(targetId?targetId:defaultTarget)},Diff2HtmlUI.prototype._getLanguages=function($target){var allFileLanguages=[];return diffJson?allFileLanguages=diffJson.map(function(line){return line.language}):$target.find(".d2h-file-wrapper").map(function(i,file){allFileLanguages.push($(file).data("lang"))}),this._distinct(allFileLanguages)},Diff2HtmlUI.prototype._getHashTag=function(){var docUrl=document.URL,hashTagIndex=docUrl.indexOf("#"),hashTag=null;return-1!=hashTagIndex&&(hashTag=docUrl.substr(hashTagIndex+1)),hashTag},Diff2HtmlUI.prototype._distinct=function(collection){return collection.filter(function(v,i){return collection.indexOf(v)===i})},module.exports.Diff2HtmlUI=Diff2HtmlUI,global.Diff2HtmlUI=Diff2HtmlUI}()}).call(exports,function(){return this}())}]);
|
||||
31
dist/diff2html.css
vendored
31
dist/diff2html.css
vendored
|
|
@ -69,11 +69,14 @@
|
|||
border-collapse: collapse;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
font-size: 12px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.d2h-diff-tbody > tr > td > div {
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.d2h-files-diff {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -244,7 +247,7 @@
|
|||
}
|
||||
|
||||
.d2h-file-list {
|
||||
display: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.d2h-clear {
|
||||
|
|
@ -268,24 +271,10 @@ ins.d2h-change, del.d2h-change {
|
|||
background-color: #ded;
|
||||
}
|
||||
|
||||
/* CSS only show/hide */
|
||||
.d2h-show {
|
||||
.d2h-file-switch {
|
||||
display: none;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.d2h-hide {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.d2h-hide:target + .d2h-show {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.d2h-hide:target {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.d2h-hide:target ~ .d2h-file-list {
|
||||
display: block;
|
||||
font-size: 10px;
|
||||
cursor: pointer;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
|
|
|||
12
dist/diff2html.js
vendored
12
dist/diff2html.js
vendored
|
|
@ -287,6 +287,7 @@
|
|||
|
||||
var diffLines =
|
||||
diffInput.replace(/\\ No newline at end of file/g, '')
|
||||
.replace(/\r\n?/g, '\n')
|
||||
.split('\n');
|
||||
|
||||
/* Diff */
|
||||
|
|
@ -421,10 +422,6 @@
|
|||
.replace(/\t/g, ' ');
|
||||
};
|
||||
|
||||
Utils.prototype.getRandomId = function(prefix) {
|
||||
return prefix + '-' + Math.random().toString(36).slice(-3);
|
||||
};
|
||||
|
||||
Utils.prototype.startsWith = function(str, start) {
|
||||
if (typeof start === 'object') {
|
||||
var result = false;
|
||||
|
|
@ -463,18 +460,15 @@
|
|||
(function() {
|
||||
|
||||
var printerUtils = __webpack_require__(4).PrinterUtils;
|
||||
var utils = __webpack_require__(2).Utils;
|
||||
|
||||
function FileListPrinter() {
|
||||
}
|
||||
|
||||
FileListPrinter.prototype.generateFileList = function(diffFiles) {
|
||||
var hideId = utils.getRandomId('d2h-hide'); // Necessary if there are 2 elements like this in the same page
|
||||
var showId = utils.getRandomId('d2h-show');
|
||||
return '<div class="d2h-file-list-wrapper">\n' +
|
||||
' <div class="d2h-file-list-header">Files changed (' + diffFiles.length + ')  </div>\n' +
|
||||
' <a id="' + hideId + '" class="d2h-hide" href="#' + hideId + '">+</a>\n' +
|
||||
' <a id="' + showId + 'd2h-show" class="d2h-show" href="#' + showId + '">-</a>\n' +
|
||||
' <a class="d2h-file-switch d2h-hide">hide</a>\n' +
|
||||
' <a class="d2h-file-switch d2h-show">show</a>\n' +
|
||||
' <div class="d2h-clear"></div>\n' +
|
||||
' <table class="d2h-file-list">\n' +
|
||||
|
||||
|
|
|
|||
2
dist/diff2html.min.css
vendored
2
dist/diff2html.min.css
vendored
|
|
@ -1 +1 @@
|
|||
.d2h-code-line-prefix,.line-num1{float:left}.d2h-wrapper{display:block;margin:0 auto;text-align:left;width:100%}.d2h-file-wrapper{border:1px solid #ddd;border-radius:3px;margin-bottom:1em}.d2h-file-header{padding:5px 10px;border-bottom:1px solid #d8d8d8;background-color:#f7f7f7;font:13px Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol"}.d2h-file-stats{display:inline;font-size:12px;text-align:center;max-width:15%}.d2h-lines-added{text-align:right}.d2h-lines-added>*{background-color:#ceffce;border:1px solid #b4e2b4;color:#399839;border-radius:5px 0 0 5px;padding:2px}.d2h-lines-deleted{text-align:left}.d2h-lines-deleted>*{background-color:#f7c8c8;border:1px solid #e9aeae;color:#c33;border-radius:0 5px 5px 0;padding:2px}.d2h-file-name{display:inline;line-height:33px;max-width:80%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.d2h-file-diff,.d2h-file-side-diff{overflow-x:scroll;overflow-y:hidden}.d2h-diff-table{border-collapse:collapse;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;height:18px;line-height:18px;width:100%}.d2h-files-diff{width:100%}.d2h-file-side-diff{display:inline-block;width:50%;margin-right:-4px}.d2h-code-line,.d2h-code-side-line{display:block;padding:0 10px;height:18px;line-height:18px;color:inherit;overflow-x:inherit;background:0 0}.d2h-code-line{margin-left:80px}.d2h-code-side-line{white-space:pre;margin-left:50px}.d2h-code-line del,.d2h-code-side-line del{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#ffb6ba;border-radius:.2em}.d2h-code-line ins,.d2h-code-side-line ins{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#97f295;border-radius:.2em}.d2h-code-line-ctn,.d2h-code-line-prefix{background:0 0;padding:0}.d2h-code-linenumber,.d2h-code-side-linenumber{position:absolute;height:18px;line-height:18px;background-color:#fff;text-align:right;cursor:pointer;color:rgba(0,0,0,.3)}.line-num1,.line-num2{width:32px;padding-left:3px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}.line-num2{float:right}.d2h-hide,.d2h-show{float:left}.d2h-code-linenumber{box-sizing:border-box;width:82px;padding-left:2px;padding-right:2px;border:solid #eee;border-width:0 1px}.d2h-code-side-linenumber{box-sizing:border-box;width:52px;padding-left:10px;padding-right:10px;border:solid #eee;border-width:0 1px;overflow:hidden;text-overflow:ellipsis}.d2h-del{background-color:#fee8e9;border-color:#e9aeae}.d2h-ins{background-color:#dfd;border-color:#b4e2b4}.d2h-info{background-color:#f8fafd;color:rgba(0,0,0,.3);border-color:#d5e4f2}.d2h-file-list-wrapper{margin-bottom:10px;padding:0 10px}.d2h-file-list-wrapper a{text-decoration:none;color:#3572b0}.d2h-file-list-wrapper a:visited{color:#3572b0}.d2h-file-list-header{font-weight:700;float:left}.d2h-file-list-line{text-align:left;font:13px Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol"}.d2h-file-list-line .d2h-file-name{line-height:21px}.d2h-file-list{display:none}.d2h-clear{display:block;clear:both}.d2h-del.d2h-change,.d2h-ins.d2h-change{background-color:#ffc}del.d2h-change,ins.d2h-change{background-color:#fad771}.d2h-file-diff .d2h-del.d2h-change{background-color:#fae1af}.d2h-file-diff .d2h-ins.d2h-change{background-color:#ded}.d2h-show{display:none}.d2h-hide:target+.d2h-show{display:inline}.d2h-hide:target{display:none}.d2h-hide:target~.d2h-file-list{display:block}
|
||||
.d2h-code-line-prefix,.line-num1{float:left}.d2h-wrapper{display:block;margin:0 auto;text-align:left;width:100%}.d2h-file-wrapper{border:1px solid #ddd;border-radius:3px;margin-bottom:1em}.d2h-file-header{padding:5px 10px;border-bottom:1px solid #d8d8d8;background-color:#f7f7f7;font:13px Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol"}.d2h-file-stats{display:inline;font-size:12px;text-align:center;max-width:15%}.d2h-lines-added{text-align:right}.d2h-lines-added>*{background-color:#ceffce;border:1px solid #b4e2b4;color:#399839;border-radius:5px 0 0 5px;padding:2px}.d2h-lines-deleted{text-align:left}.d2h-lines-deleted>*{background-color:#f7c8c8;border:1px solid #e9aeae;color:#c33;border-radius:0 5px 5px 0;padding:2px}.d2h-file-name{display:inline;line-height:33px;max-width:80%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}.d2h-file-diff,.d2h-file-side-diff{overflow-x:scroll;overflow-y:hidden}.d2h-diff-table{border-collapse:collapse;font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;font-size:12px;width:100%}.d2h-diff-tbody>tr>td>div{height:16px;line-height:16px}.d2h-files-diff{width:100%}.d2h-file-side-diff{display:inline-block;width:50%;margin-right:-4px}.d2h-code-line,.d2h-code-side-line{padding:0 10px;height:18px;line-height:18px;color:inherit;overflow-x:inherit;background:0 0;display:block}.d2h-code-line{margin-left:80px}.d2h-code-side-line{white-space:pre;margin-left:50px}.d2h-code-line del,.d2h-code-side-line del{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#ffb6ba;border-radius:.2em}.d2h-code-line ins,.d2h-code-side-line ins{display:inline-block;margin-top:-1px;text-decoration:none;background-color:#97f295;border-radius:.2em}.d2h-code-line-ctn,.d2h-code-line-prefix{background:0 0;padding:0}.d2h-code-linenumber,.d2h-code-side-linenumber{position:absolute;height:18px;line-height:18px;background-color:#fff;text-align:right;color:rgba(0,0,0,.3);cursor:pointer}.line-num1,.line-num2{width:32px;padding-left:3px;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis}.line-num2{float:right}.d2h-code-linenumber{box-sizing:border-box;width:82px;padding-left:2px;padding-right:2px;border:solid #eee;border-width:0 1px}.d2h-code-side-linenumber{box-sizing:border-box;width:52px;padding-left:10px;padding-right:10px;border:solid #eee;border-width:0 1px;overflow:hidden;text-overflow:ellipsis}.d2h-del{background-color:#fee8e9;border-color:#e9aeae}.d2h-ins{background-color:#dfd;border-color:#b4e2b4}.d2h-info{background-color:#f8fafd;color:rgba(0,0,0,.3);border-color:#d5e4f2}.d2h-file-list-wrapper{margin-bottom:10px;padding:0 10px}.d2h-file-list-wrapper a{text-decoration:none;color:#3572b0}.d2h-file-list-wrapper a:visited{color:#3572b0}.d2h-file-list-header{font-weight:700;float:left}.d2h-file-list-line{text-align:left;font:13px Helvetica,arial,freesans,clean,sans-serif,"Segoe UI Emoji","Segoe UI Symbol"}.d2h-file-list-line .d2h-file-name{line-height:21px}.d2h-file-list{display:block}.d2h-clear{display:block;clear:both}.d2h-del.d2h-change,.d2h-ins.d2h-change{background-color:#ffc}del.d2h-change,ins.d2h-change{background-color:#fad771}.d2h-file-diff .d2h-del.d2h-change{background-color:#fae1af}.d2h-file-diff .d2h-ins.d2h-change{background-color:#ded}.d2h-file-switch{display:none;float:left;font-size:10px;cursor:pointer;margin-top:3px}
|
||||
6
dist/diff2html.min.js
vendored
6
dist/diff2html.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "diff2html",
|
||||
"version": "1.3.2",
|
||||
"version": "2.0.0-beta1",
|
||||
"homepage": "http://rtfpessoa.github.io/diff2html/",
|
||||
"description": "Fast Diff to colorized HTML",
|
||||
"keywords": [
|
||||
|
|
@ -51,10 +51,10 @@
|
|||
"codacy-coverage": "^1.1.3",
|
||||
"fast-html-parser": "^1.0.1",
|
||||
"istanbul": "^0.4.2",
|
||||
"jscs": "^2.9.0",
|
||||
"jscs": "^2.10.1",
|
||||
"mocha": "^2.4.5",
|
||||
"uglifyjs": "^2.4.10",
|
||||
"webpack": "^1.12.12"
|
||||
"webpack": "^1.12.13"
|
||||
},
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
|
|
|
|||
11
release.sh
11
release.sh
|
|
@ -8,6 +8,7 @@
|
|||
set -e
|
||||
|
||||
INPUT_DIR=src
|
||||
INTPUT_TEMPLATES_DIR=${INPUT_DIR}/templates
|
||||
INPUT_UI_DIR=${INPUT_DIR}/ui
|
||||
INPUT_JS_FILE=${INPUT_DIR}/diff2html.js
|
||||
INPUT_JS_UI_FILE=${INPUT_UI_DIR}/js/diff2html-ui.js
|
||||
|
|
@ -20,10 +21,8 @@ OUTPUT_JS_UI_FILE=${OUTPUT_DIR}/diff2html-ui.js
|
|||
OUTPUT_MIN_JS_UI_FILE=${OUTPUT_DIR}/diff2html-ui.min.js
|
||||
OUTPUT_CSS_FILE=${OUTPUT_DIR}/diff2html.css
|
||||
OUTPUT_MIN_CSS_FILE=${OUTPUT_DIR}/diff2html.min.css
|
||||
OUTPUT_TEMPLATES_FILE=${OUTPUT_DIR}/templates.js
|
||||
OUTPUT_MIN_TEMPLATES_FILE=${OUTPUT_DIR}/templates.min.js
|
||||
|
||||
TEMPLATES_DIR=src/templates
|
||||
OUTPUT_TEMPLATES_FILE=${OUTPUT_DIR}/diff2html-templates.js
|
||||
OUTPUT_MIN_TEMPLATES_FILE=${OUTPUT_DIR}/diff2html-templates.min.js
|
||||
|
||||
echo "Creating diff2html release ..."
|
||||
|
||||
|
|
@ -43,8 +42,8 @@ webpack ${INPUT_JS_UI_FILE} ${OUTPUT_JS_UI_FILE}
|
|||
echo "Minifying ${OUTPUT_JS_UI_FILE} to ${OUTPUT_MIN_JS_UI_FILE}"
|
||||
uglifyjs ${OUTPUT_JS_UI_FILE} -c -o ${OUTPUT_MIN_JS_UI_FILE}
|
||||
|
||||
echo "Pre-compile nunjucks templates in ${TEMPLATES_DIR}"
|
||||
nunjucks-precompile ${TEMPLATES_DIR} > ${OUTPUT_TEMPLATES_FILE}
|
||||
echo "Pre-compile nunjucks templates in ${INTPUT_TEMPLATES_DIR}"
|
||||
nunjucks-precompile ${INTPUT_TEMPLATES_DIR} > ${OUTPUT_TEMPLATES_FILE}
|
||||
|
||||
echo "Minifying ${OUTPUT_TEMPLATES_FILE} to ${OUTPUT_MIN_TEMPLATES_FILE}"
|
||||
uglifyjs ${OUTPUT_TEMPLATES_FILE} -c -o ${OUTPUT_MIN_TEMPLATES_FILE}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/languages/scala.min.js"></script>
|
||||
|
||||
<!-- diff2html -->
|
||||
<link rel="stylesheet" type="text/css" href="../dist/diff2html.min.css">
|
||||
<script type="text/javascript" src="../dist/templates.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../dist/diff2html.css">
|
||||
<script type="text/javascript" src="../dist/diff2html-templates.js"></script>
|
||||
<script type="text/javascript" src="../dist/diff2html.js"></script>
|
||||
<script type="text/javascript" src="../dist/diff2html-ui.js"></script>
|
||||
<!-- -->
|
||||
|
|
|
|||
|
|
@ -69,11 +69,14 @@
|
|||
border-collapse: collapse;
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
font-size: 12px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.d2h-diff-tbody > tr > td > div {
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
}
|
||||
|
||||
.d2h-files-diff {
|
||||
width: 100%;
|
||||
}
|
||||
|
|
@ -93,7 +96,6 @@
|
|||
|
||||
.d2h-code-line {
|
||||
display: block;
|
||||
white-space: pre;
|
||||
padding: 0 10px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
|
|
|
|||
|
|
@ -68,8 +68,6 @@
|
|||
|
||||
var languages = that._getLanguages($target);
|
||||
|
||||
console.log(languages);
|
||||
|
||||
// pass the languages to the highlightjs plugin
|
||||
hljs.configure({languages: languages});
|
||||
|
||||
|
|
@ -100,18 +98,13 @@
|
|||
return line.language;
|
||||
});
|
||||
} else {
|
||||
console.log($target.find(".d2h-file-wrapper"));
|
||||
$target.find(".d2h-file-wrapper").map(function(i, file) {
|
||||
allFileLanguages.push($(file).data("lang"));
|
||||
});
|
||||
}
|
||||
|
||||
// remove duplicated languages
|
||||
var distinctLanguages = allFileLanguages.filter(function(v, i) {
|
||||
return allFileLanguages.indexOf(v) === i;
|
||||
});
|
||||
|
||||
return distinctLanguages;
|
||||
// return only distinct languages
|
||||
return this._distinct(allFileLanguages);
|
||||
};
|
||||
|
||||
Diff2HtmlUI.prototype._getHashTag = function() {
|
||||
|
|
@ -126,6 +119,12 @@
|
|||
return hashTag;
|
||||
};
|
||||
|
||||
Diff2HtmlUI.prototype._distinct = function(collection) {
|
||||
return collection.filter(function(v, i) {
|
||||
return collection.indexOf(v) === i;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.Diff2HtmlUI = Diff2HtmlUI;
|
||||
|
||||
// Expose diff2html in the browser
|
||||
|
|
|
|||
Loading…
Reference in a new issue