Skip to content

Commit

Permalink
Merge pull request #343 from prettydiff/2.1.4
Browse files Browse the repository at this point in the history
bug fixes
  • Loading branch information
prettydiff committed Aug 16, 2016
2 parents 282789b + 558366a commit aa9e3a5
Show file tree
Hide file tree
Showing 17 changed files with 14,364 additions and 14,318 deletions.
2 changes: 1 addition & 1 deletion .bower.json
@@ -1,6 +1,6 @@
{
"name" : "prettydiff",
"version" : "2.1.3",
"version" : "2.1.4",
"description" : "Pretty Diff can minify, beautify (pretty print), or diff code to normalize white space and comments so that only code is being compared.",
"keywords" : [
"pretty diff", "minify", "beautify", "pretty print", "white space", "whitespace", "diff", "compare", "html", "javascript", "xml", "json", "css", "less", "scss", "scope", "analysis", "node", "nodejs", "wsh"
Expand Down
47 changes: 25 additions & 22 deletions .prettydiffrc
Expand Up @@ -9,34 +9,37 @@
//if (option.mode === "beautify" || option.lang === "auto") {
// option.wrap = 120;
//}
global.prettydiff.prettydiffrc = function (option) {
(function prettydiffrc_init() {
"use strict";
// edit below this line
var prettydiffrc = function prettydiffrc(option) {
// edit below this line







// edit above this line
return option;
};
// edit above this line
return option;
};

if (typeof module === "object" && typeof module.parent === "object") {
//commonjs and nodejs support
module.exports = global.prettydiff.prettydiffrc;
} else if ((typeof define === "object" || typeof define === "function") && (typeof ace !== "object" || ace.prettydiffid === undefined)) {
//requirejs support
define(function requirejs(require, module) {
"use strict";
module.exports = global.prettydiffrc.preset;
//worthless if block to appease RequireJS and JSLint
if (typeof require === "number") {
return require;
}
return function requirejs_prettydiffrc_module(x) {
global.prettydiff.prettydiffrc(x);
};
});
}
if (typeof module === "object" && typeof module.parent === "object") {
//commonjs and nodejs support
module.exports = prettydiffrc;
} else if ((typeof define === "object" || typeof define === "function") && (typeof ace !== "object" || ace.prettydiffid === undefined)) {
//requirejs support
define(function requirejs(require, module) {
module.exports = prettydiffrc;
//worthless if block to appease RequireJS and JSLint
if (typeof require === "number") {
return require;
}
return function requirejs_prettydiffrc_module(x) {
prettydiffrc(x);
};
});
} else {
global.prettydiff.prettydiffrc = prettydiffrc;
}
}());
7 changes: 1 addition & 6 deletions api/dom.js
Expand Up @@ -841,7 +841,7 @@ global.prettydiff.meta = {
if (item.nodeName.toLowerCase() === "select") {
node = item[item.selectedIndex].value;
} else {
node = node.value;
node = item.value;
}
pd.data.commentString = global.prettydiff.options.functions.domops(id, node, pd.data.commentString);
if (pd.data.node.comment !== null) {
Expand Down Expand Up @@ -6440,11 +6440,6 @@ global.prettydiff.meta = {
if (pd.data.node.comment !== null) {
if (pd.data.commentString.length === 0) {
pd.data.node.comment.innerHTML = "/*prettydiff.com */";
} else if (pd.data.commentString.length === 1) {
pd.data.node.comment.innerHTML = "/*prettydiff.com " + pd
.data
.commentString[0]
.replace("api.", "") + " */";
} else {
pd.data.node.comment.innerHTML = "/*prettydiff.com " + pd
.data
Expand Down
59 changes: 35 additions & 24 deletions api/node-local.js
Expand Up @@ -44,34 +44,20 @@ Examples:
cwd = (process.cwd() === "/")
? __dirname
: process.cwd(),
libs = (function pdNodeLocal__libs() {
global.prettydiff = {};
global.prettydiff.language = require(localPath + "lib/language.js");
global.prettydiff.safeSort = require(localPath + "lib/safeSort.js");
global.prettydiff.options = require(localPath + "lib/options.js");
global.prettydiff.csspretty = require(localPath + "lib/csspretty.js");
global.prettydiff.csvpretty = require(localPath + "lib/csvpretty.js");
global.prettydiff.diffview = require(localPath + "lib/diffview.js");
global.prettydiff.finalFile = require(localPath + "lib/finalFile.js");
global.prettydiff.jspretty = require(localPath + "lib/jspretty.js");
global.prettydiff.markuppretty = require(localPath + "lib/markuppretty.js");
return localPath;
}()),
options = global.prettydiff.options,
options = {},
diffCount = [
0, 0, 0, 0, 0
],
method = "auto",
langauto = false,
pdapp = require(libs + "prettydiff.js"),
prettydiff = function pdNodeLocal__prettydiff() {
var lang = (function pdNodeLocal__prettydiff_lang() {
if (langauto === true) {
options.lang = "auto";
}
return options.lang;
}()),
pdresponse = pdapp(options),
pdresponse = global.prettydiff.prettydiff(options),
data = (options.nodeasync === true)
? (options.mode === "parse" && method !== "screen" && method !== "filescreen" && options.parseFormat !== "htmltable")
? JSON.stringify(pdresponse[0])
Expand Down Expand Up @@ -130,7 +116,6 @@ Examples:
],
lf = "\n",
startTime = Date.now(),
versionString = options.functions.versionString(),
dir = [
0, 0, 0
],
Expand Down Expand Up @@ -548,7 +533,7 @@ Examples:
options.diff = dfiledump[data.index];
options.source = sfiledump[data.index];
screenWrite();
} else if (method === "file" || method === "directory" || method === "subdirectory") {
} else if (method === "file" || method === "directory" || method === "subdirectory") {if(method === "subdirectory")
fileWrite(data);
}
sState[data.index] = false;
Expand Down Expand Up @@ -905,6 +890,19 @@ Examples:
}
};

global.prettydiff = {};
global.prettydiff.language = require(localPath + "lib/language.js");
global.prettydiff.safeSort = require(localPath + "lib/safeSort.js");
global.prettydiff.options = require(localPath + "lib/options.js");
global.prettydiff.csspretty = require(localPath + "lib/csspretty.js");
global.prettydiff.csvpretty = require(localPath + "lib/csvpretty.js");
global.prettydiff.diffview = require(localPath + "lib/diffview.js");
global.prettydiff.finalFile = require(localPath + "lib/finalFile.js");
global.prettydiff.jspretty = require(localPath + "lib/jspretty.js");
global.prettydiff.markuppretty = require(localPath + "lib/markuppretty.js");
global.prettydiff.prettydiff = require(localPath + "prettydiff.js");
options = global.prettydiff.options;

//defaults for the options
(function pdNodeLocal__start() {
var argument = process
Expand Down Expand Up @@ -1025,6 +1023,23 @@ Examples:
odirs = address
.oorgpath
.split(path.sep);
if (odirs[0] === "..") {
(function pdNodeLocal__start_pathslash_stat() {
var abs = path.resolve().split(path.sep),
a = 0;
do {
a += 1;
} while (odirs[a] === "..");
odirs.splice(0, a);
abs.splice(0, a);
do {
odirs.splice(0, 0, abs.pop());
} while (abs.length > 0);
if (path.sep === "/") {
odirs.splice(0, 0, "");
}
}());
}
if (options.readmethod === "file") {
odirs.pop();
}
Expand Down Expand Up @@ -1215,10 +1230,6 @@ Examples:
if (alphasort === true) {
options.objsort = "all";
}
if (options.lang === "tss") {
options.titanium = true;
options.lang = "javascript";
}
if (options.mode !== "diff") {
options.diffcli = false;
options.summaryonly = false;
Expand All @@ -1231,7 +1242,7 @@ Examples:
return console.log(options.functions.consolePrint());
}
if (help === true && options.version === true) {
return console.log(versionString);
return console.log(options.functions.versionString);
}
if (options.listoptions === true) {
(function pdNodeLocal__start_stat_init_listoptions() {
Expand All @@ -1242,7 +1253,7 @@ Examples:
options.mode = "beautify";
options.source = sample;
options.vertical = "all";
sample = pdapp(options);
sample = global.prettydiff.prettydiff(options);
console.log("");
console.log(colors.filepath.start + "Current option settings:" + colors.filepath.end);
console.log(sample.slice(1, sample.length - 1));
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -36,5 +36,5 @@
],
"main": "./",
"name": "prettydiff",
"version": "2.1.3"
"version": "2.1.4"
}

0 comments on commit aa9e3a5

Please sign in to comment.