Skip to content

Commit 4ba9dce

Browse files
committed
Merge branch 'master' of git://github.com/warrenrumak/Autolinker.js into add-html-quote-entity
2 parents bc96ed7 + 5cc2559 commit 4ba9dce

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Autolinker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ Autolinker.prototype = {
185185
*
186186
* Ignoring & as it could be part of a query string -- handling it separately.
187187
*/
188-
htmlCharacterEntitiesRegex: /( | |<|<|>|>)/gi,
188+
htmlCharacterEntitiesRegex: /( | |<|<|>|>|"|"|')/gi,
189189

190190
/**
191191
* @private

tests/AutolinkerSpec.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,6 @@ describe( "Autolinker", function() {
993993
expect( result ).toBe('<p>Joe went to <a href="http://yahoo.com">yahoo.com</a>&nbsp;and <a href="http://google.com">google.com</a>&nbsp;today</p>');
994994
} );
995995

996-
997996
it( "should handle HTML entities like &nbsp; within a non-autolinked part of a text node, properly appending it to the output", function() {
998997
var html = "Joe went to yahoo.com and used HTML&nbsp;entities like &gt; and &lt; google.com";
999998

@@ -1017,6 +1016,13 @@ describe( "Autolinker", function() {
10171016
expect( result ).toBe( '<a href="http://close.io/" style="font-family: Helvetica,\nArial">http://close.io</a>' );
10181017
} );
10191018

1019+
it( "should handle a URL inside an HTML-encoded anchor tag (Issue #76)", function() {
1020+
var html = "Joe learned about anchor tags on the &lt;a href=&quot;http://www.w3schools.com/aaa&quot;&gt;W3SCHOOLS&lt;/a&gt; site ...";
1021+
var tobe = "Joe learned about anchor tags on the &lt;a href=&quot;<a href=\"http://www.w3schools.com/aaa\">w3schools.com/aaa</a>&quot;&gt;W3SCHOOLS&lt;/a&gt; site ...";
1022+
1023+
var result = autolinker.link( html );
1024+
expect( result ).toBe( tobe );
1025+
});
10201026
} );
10211027

10221028

0 commit comments

Comments
 (0)