Content deleted Content added
1.0.4 (August 26, 2014) sort blocks moved from block by old number |
1.0.5 (August 26, 2014) fix fragment marks (maxWords), fullDiff support |
||
Line 2:
// @name wDiff
// @version 1.0.
// @date August 26, 2014
// @description improved word-based diff library with block move detection
Line 1,888:
// moved block too small, make it a deletion at its original position
if ( (groups[movedGroup].
mark = wDiff.htmlDeleteStart + wDiff.HtmlEscape(movedText) + wDiff.htmlDeleteEnd;
}
Line 1,994:
text.diff = text.diff.replace(/<\/(\w+)><!--wDiff(Delete|Insert)--><\1\b[^>]*\bclass="wDiff\2"[^>]*>/g, '');
text.diff = text.diff.replace(/\t/g, wDiff.htmlTab);
text.diff = wDiff.htmlContainerStart + wDiff.htmlFragmentStart + text.diff + wDiff.htmlFragmentEnd + wDiff.htmlContainerEnd;
return;
};
Line 2,013:
// remove container by non-regExp replace
html = html.replace(wDiff.htmlFragmentEnd, '');
html = html.replace(wDiff.htmlContainerEnd, '')
// scan for diff html tags
var regExpDiff = /<\w+\b[^>]*\bclass="wDiff(MarkLeft|MarkRight|BlockLeft|BlockRight|Delete|Insert)"[^>]*>(.|\n)*?<!--wDiff\1-->/g;
Line 2,304 ⟶ 2,306:
wDiff.DebugGroups = function(groups) {
var dump = '\ni \tblSta \tblEnd \tmWord \twords \tchars \tfixed \oldNm
for (var i = 0; i < groups.length; i ++) {
dump += i + ' \t' + groups[i].blockStart + ' \t' + groups[i].blockEnd + ' \t' + groups[i].maxWords + ' \t' + groups[i].words + ' \t' + groups[i].chars + ' \t' + groups[i].fixed + ' \t' + groups[i].oldNumber + ' \t' + groups[i].
}
return dump;
|