File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ var _ = require('lodash'),
1212HtmlDiff . prototype . tokenize = function ( html ) {
1313 html = modifyHtmlAccordingToOptions ( html , this . options ) ;
1414
15- return _ . filter ( html . split ( / ( { { .+ ?[ ^ \\ ] } } (? ! } ) | [ { } = : ; , < > " ' \[ \] \/ ] | \s + ) / ) ) ;
15+ return _ . filter ( html . split ( / ( { { .+ ?[ ^ \\ ] } } (? ! } ) | [ { } \( \) = : ; , < > " ' \[ \] \/ ] | \s + ) / ) ) ;
1616} ;
1717
1818/**
Original file line number Diff line number Diff line change 44 *
55 * {{RegExp}}
66 */
7- var MASK_REGEXP = / ( .* ) { { ( .+ [ ^ \\ ] ) } } (? ! } ) ( .* ) / ;
7+ var MASK_REGEXP = / ( .* ) { { ( .+ [ ^ \\ ] ) } } (? ! } ) ( .* ) / ,
8+ specialСhars = / ( [ ^ A - Z a - z А - Я а - я 0 - 9 _ \- \s ] ) / g;
89
910/**
1011 * Checks whether the given part of the diff should be added or removed
@@ -32,7 +33,11 @@ function _revealMasks(diff) {
3233
3334 if ( ! matchedMask ) continue ;
3435
35- var regExp = new RegExp ( '^' + matchedMask [ 1 ] + matchedMask [ 2 ] + matchedMask [ 3 ] + '$' ) ;
36+ var regExp = new RegExp ( '^' +
37+ matchedMask [ 1 ] . replace ( specialСhars , '\\$1' ) +
38+ matchedMask [ 2 ] +
39+ matchedMask [ 3 ] . replace ( specialСhars , '\\$1' ) + '$' ) ;
40+
3641 if ( currPart . added && nextPart && nextPart . removed ) {
3742 if ( nextPart . value . match ( regExp ) ) {
3843 nextPart . removed = undefined ;
Original file line number Diff line number Diff line change 11AZ< meta charset ="UTF-32 ">
2+ < span style ="#url{1,3}+ ({{\d}}) ">
23< div id ="blah{{\d+}}blah "> </ div > bl{{\}}{=ah 5
Original file line number Diff line number Diff line change 11{{[A-Z]+}}< meta charset ="{{UTF-\d{1,2}}} ">
2+ < span style ="#url{1,3}+ (1) ">
23< div id ="blah12345blah "> </ div > {{bl\{\{\\\}}{=ah\s\d}}
You can’t perform that action at this time.
0 commit comments