Skip to content

Commit 0ade88c

Browse files
authored
Merge pull request #242 from bgryszko/feature/match-joined-tags
Update compactMatches logic to allow multiple matches
2 parents 5322088 + 97a5edf commit 0ade88c

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Autolinker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ Autolinker.prototype = {
667667
}
668668

669669
// Remove subsequent matches that overlap with the current match
670-
if( matches[ i + 1 ].getOffset() <= endIdx ) {
670+
if( matches[ i + 1 ].getOffset() < endIdx ) {
671671
matches.splice( i + 1, 1 );
672672
}
673673
}

tests/AutolinkerSpec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,6 +1759,15 @@ describe( "Autolinker", function() {
17591759
} );
17601760

17611761

1762+
it( "should parse joined matchers", function() {
1763+
var html = "+1123123123http://google.com";
1764+
var tobe = "<a href=\"tel:+1123123123\">+1123123123</a><a href=\"http://google.com\">google.com</a>";
1765+
1766+
var result = autolinker.link( html );
1767+
expect( result ).toBe( tobe );
1768+
} );
1769+
1770+
17621771
} );
17631772

17641773

0 commit comments

Comments
 (0)