minor fix, before diff engine refactor
This commit is contained in:
parent
c764eb5b45
commit
3326eaccb7
@ -99,43 +99,12 @@
|
||||
},
|
||||
"buffers":
|
||||
[
|
||||
{
|
||||
"file": "client/app/wdiff/wdiff.controller.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1167,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 0,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "server/api/wdiff/index.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 248,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "server/api/wdiff/wdiff.controller.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2687,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "client/index.html",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 3904,
|
||||
"line_ending": "Unix"
|
||||
"buffer_size": 3458,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -150,66 +119,28 @@
|
||||
"file": "client/app/app.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1515,
|
||||
"line_ending": "Unix"
|
||||
"buffer_size": 349,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "client/app/wdiff/wdiff.js",
|
||||
"file": "server/components/wdiff/index.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 224,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "client/app/wdiff/wdiff.jade",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1122,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "client/app/wdiff/wdiff.scss",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 553,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "bin/markdown-format-wdiff",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 711,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "bin/markdown-git-changes",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2724,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
},
|
||||
{
|
||||
"contents": "'use strict';\n\nangular.module('markdownFormatWdiffApp')\n .config(function ($routeProvider) {\n $routeProvider\n .when('/oldmain', {\n templateUrl: 'app/main/main.html',\n controller: 'MainCtrl'\n });\n });",
|
||||
"file": "client/app/main/main.js",
|
||||
"file_size": -1,
|
||||
"file_write_time": -1,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 228,
|
||||
"buffer_size": 8038,
|
||||
"line_ending": "Unix"
|
||||
}
|
||||
}
|
||||
],
|
||||
"build_system": "",
|
||||
"build_system_choices":
|
||||
[
|
||||
],
|
||||
"build_varint": "",
|
||||
"command_palette":
|
||||
{
|
||||
"height": 157.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
@ -255,19 +186,22 @@
|
||||
},
|
||||
"expanded_folders":
|
||||
[
|
||||
"/Z/markdown-format-wdiff",
|
||||
"/Z/markdown-format-wdiff/bin",
|
||||
"/Z/markdown-format-wdiff/client",
|
||||
"/Z/markdown-format-wdiff/client/app",
|
||||
"/Z/markdown-format-wdiff/client/app/wdiff",
|
||||
"/Z/markdown-format-wdiff/server",
|
||||
"/Z/markdown-format-wdiff/server/api",
|
||||
"/Z/markdown-format-wdiff/server/api/wdiff",
|
||||
"/Z/markdown-format-wdiff/server/config",
|
||||
"/Z/markdown-format-wdiff/server/config/environment"
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client/app",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/server",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/server/components",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/server/components/wdiff"
|
||||
],
|
||||
"file_history":
|
||||
[
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client/app/main/main.js",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/bin/markdown-format-wdiff",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client/app/wdiff/wdiff.scss",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client/app/wdiff/wdiff.jade",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client/app/wdiff/wdiff.js",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/server/api/wdiff/wdiff.controller.js",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/server/api/wdiff/index.js",
|
||||
"/C/Users/Adam/Desktop/code/projects/dubdiff/client/app/wdiff/wdiff.controller.js",
|
||||
"/Z/lookup-lists/Gruntfile.js",
|
||||
"/Z/docker/data/lookup-lists/client/app/list/list/list.jade",
|
||||
"/Z/docker/data/lookup-lists/client/app/list/list/list.controller.js",
|
||||
@ -387,19 +321,11 @@
|
||||
"/C/Users/adam/Desktop/vagrant/node/scripttest/Gruntfile.js",
|
||||
"/C/Users/adam/Desktop/vagrant/node/scripttest/package.json",
|
||||
"/C/Users/adam/Desktop/vagrant/node/angular-phonecat/app/index.html",
|
||||
"/C/Users/adam/Desktop/vagrant/node/learning-mean-holmes/package.json",
|
||||
"/C/Users/adam/Desktop/vagrant/node/learning-mean-holmes/app.js",
|
||||
"/C/Users/adam/Desktop/vagrant/node/learning-mean-holmes/bower.json",
|
||||
"/C/Users/adam/Desktop/vagrant/node/learning-mean-holmes/bin/www",
|
||||
"/C/Users/adam/Desktop/git/learning-nodejs-hello/README.md",
|
||||
"/C/Users/adam/Desktop/git/learning-nodejs-passport/README.md",
|
||||
"/C/Users/adam/Desktop/git/learning-nodejs-passport/test2/Gruntfile.js",
|
||||
"/C/Users/adam/Desktop/git/learning-nodejs-passport/test.sh",
|
||||
"/C/Users/adam/Desktop/git/learning-nodejs-passport/bootstrap-npm.sh"
|
||||
"/C/Users/adam/Desktop/vagrant/node/learning-mean-holmes/package.json"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
"height": 43.0
|
||||
"height": 47.0
|
||||
},
|
||||
"find_in_files":
|
||||
{
|
||||
@ -569,140 +495,24 @@
|
||||
"groups":
|
||||
[
|
||||
{
|
||||
"selected": 1,
|
||||
"selected": 3,
|
||||
"sheets":
|
||||
[
|
||||
{
|
||||
"buffer": 0,
|
||||
"file": "client/app/wdiff/wdiff.controller.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1167,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
491,
|
||||
491
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 1,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 1,
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 0,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
0,
|
||||
0
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"default_dir": "Z:\\markdown-format-wdiff\\server\\api",
|
||||
"syntax": "Packages/Text/Plain text.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 0,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 2,
|
||||
"file": "server/api/wdiff/index.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 248,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
0,
|
||||
0
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 11,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 3,
|
||||
"file": "server/api/wdiff/wdiff.controller.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2687,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
2524,
|
||||
2524
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 1142.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 2,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 4,
|
||||
"file": "client/index.html",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 3904,
|
||||
"buffer_size": 3458,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
2796,
|
||||
2796
|
||||
0,
|
||||
0
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
@ -712,14 +522,14 @@
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 810.0,
|
||||
"translation.y": 516.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 8,
|
||||
"stack_index": 2,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 5,
|
||||
"buffer": 1,
|
||||
"file": "bower.json",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
@ -745,162 +555,16 @@
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 9,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 6,
|
||||
"file": "client/app/app.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1515,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
302,
|
||||
302
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 10,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 7,
|
||||
"file": "client/app/wdiff/wdiff.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 224,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
127,
|
||||
127
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 5,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 8,
|
||||
"file": "client/app/wdiff/wdiff.jade",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1122,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
417,
|
||||
417
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/Jade/Syntaxes/Jade.tmLanguage",
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 378.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 3,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 9,
|
||||
"file": "client/app/wdiff/wdiff.scss",
|
||||
"buffer": 2,
|
||||
"file": "client/app/app.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 553,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
106,
|
||||
106
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/Sass/Syntaxes/Sass.tmLanguage",
|
||||
"tab_size": 4,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 4,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 10,
|
||||
"file": "bin/markdown-format-wdiff",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 711,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
501,
|
||||
501
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/ShellScript/Shell-Unix-Generic.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 6,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 11,
|
||||
"file": "bin/markdown-git-changes",
|
||||
"semi_transient": true,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2724,
|
||||
"buffer_size": 349,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
@ -913,43 +577,45 @@
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/ShellScript/Shell-Unix-Generic.tmLanguage",
|
||||
"tab_size": 4,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 7,
|
||||
"stack_index": 1,
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 12,
|
||||
"file": "client/app/main/main.js",
|
||||
"buffer": 3,
|
||||
"file": "server/components/wdiff/index.js",
|
||||
"semi_transient": false,
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 228,
|
||||
"buffer_size": 8038,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
134,
|
||||
134
|
||||
1952,
|
||||
1952
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
"syntax": "Packages/Babel/JavaScript (Babel).sublime-syntax",
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 0.0,
|
||||
"translation.y": 264.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"stack_index": 12,
|
||||
"stack_index": 0,
|
||||
"type": "text"
|
||||
}
|
||||
]
|
||||
@ -994,6 +660,7 @@
|
||||
{
|
||||
"height": 0.0
|
||||
},
|
||||
"pinned_build_system": "",
|
||||
"project": "markdown-format-wdiff.sublime-project",
|
||||
"replace":
|
||||
{
|
||||
@ -1003,6 +670,7 @@
|
||||
"select_file":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
@ -1015,6 +683,7 @@
|
||||
"select_project":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
@ -1023,6 +692,7 @@
|
||||
"select_symbol":
|
||||
{
|
||||
"height": 0.0,
|
||||
"last_filter": "",
|
||||
"selected_items":
|
||||
[
|
||||
],
|
||||
|
@ -29,25 +29,6 @@ exports.showComparison = function showComparison(req, res) {
|
||||
});
|
||||
}
|
||||
|
||||
//return the a or b doc for a comparison given an id, if it exsits
|
||||
exports.showComparison = function showComparison(req, res) {
|
||||
//generate a filename
|
||||
var filename = fnComparison(req.params.id);
|
||||
|
||||
//check if that file exists
|
||||
fs.exists(filename, function (exists) {
|
||||
//if the file does not exist, return a 404
|
||||
if (!exists) return res.send(404);
|
||||
|
||||
//otherwise, read the file as JSON
|
||||
jf.readFile(filename, function(err, comparison) {
|
||||
if(err) { return handleError(res, err); }
|
||||
|
||||
//and return
|
||||
return res.json(comparison);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
//return a markdown wdiff for the comparison given an id, if it exsits
|
||||
exports.wdiffMarkdownComparison = function wdiffMarkdownComparison(req, res) {
|
||||
|
@ -16,6 +16,15 @@ module.exports = function(a, b, asMarkdown, callback) {
|
||||
//!!! this nested file-open is not a good pattern
|
||||
// better would be to use promises and write the two files asynchronously
|
||||
|
||||
//console.log(a)
|
||||
//console.log(escapeString(a))
|
||||
|
||||
//a few strings have to be escaped: "[-", "-]", "{+", and "+}"
|
||||
a = escapeString(a)
|
||||
b = escapeString(b)
|
||||
|
||||
|
||||
|
||||
// open the first file
|
||||
temp.open('wdiffa-', function(err, filea) {
|
||||
//handle errors
|
||||
@ -43,7 +52,7 @@ module.exports = function(a, b, asMarkdown, callback) {
|
||||
if (err)
|
||||
return callback(err);
|
||||
|
||||
var cmd = "./bin/wdiff " + filea.path + " " +fileb.path;
|
||||
var cmd = "wdiff " + filea.path + " " +fileb.path;
|
||||
exec(cmd, function(err, stdout) {
|
||||
|
||||
if (err && err.code!=1 && err.code!=0) {
|
||||
@ -53,13 +62,14 @@ module.exports = function(a, b, asMarkdown, callback) {
|
||||
var wdiffSame;
|
||||
wdiffSame = (err && err.code == 0) ? true:false;
|
||||
|
||||
|
||||
var resData = {wdiffNoMarkdown:stdout, same: wdiffSame};
|
||||
var resData = {wdiffNoMarkdown:unescapeString(stdout), same: wdiffSame};
|
||||
if (asMarkdown) {
|
||||
|
||||
//!!! this needs more sophisticated parsing
|
||||
|
||||
var markdown = rewriteWdiffMarkdown(stdout)
|
||||
//console.log(stdout)
|
||||
|
||||
var markdown = unescapeString(rewriteWdiffMarkdown(stdout))
|
||||
|
||||
resData.wdiff=markdown;
|
||||
}
|
||||
@ -203,7 +213,7 @@ function rewriteWdiffMarkdown(source) {
|
||||
// |([ \t]+[\*\+-]) - unordered lists
|
||||
// |([ \t]+[0-9]+\.) - numeric lists
|
||||
// )?
|
||||
// [ \t]+ - trailing whitespace
|
||||
// [ \t]* - trailing whitespace
|
||||
//var PREFIX = /^([ \t]*\>)*(([ \t]*#*)|([ \t]*[\*\+-])|([ \t]*[\d]+\.))?[ \t]+/
|
||||
var PREFIX = /^([ \t]*\>)*(([ \t]*#*)|([ \t]*[\*\+-])|([ \t]*[\d]+\.))?[ \t]*/
|
||||
//var PREFIX = /^#*/
|
||||
@ -262,3 +272,16 @@ function rewriteWdiffMarkdown(source) {
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
function escapeString(str) {
|
||||
str = str.replace(/\[\-/gm, "[-")
|
||||
str = str.replace(/\-\]/gm, "-]")
|
||||
return str
|
||||
}
|
||||
|
||||
function unescapeString(str) {
|
||||
str = str.replace(/\&\#91\;-/gm, "[-")
|
||||
str = str.replace(/-\&\#93\;/gm, "-]")
|
||||
return str
|
||||
}
|
Loading…
Reference in New Issue
Block a user