Skip to content

Commit 3961ba6

Browse files
committed
Merge branch 'PLPeeters-master'
2 parents 07f5b1b + 358863f commit 3961ba6

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

dist/Autolinker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/*!
1818
* Autolinker.js
19-
* 0.18.0
19+
* 0.18.1
2020
*
2121
* Copyright(c) 2015 Gregory Jacobs <[email protected]>
2222
* MIT Licensed. http://www.opensource.org/licenses/mit-license.php
@@ -1727,7 +1727,7 @@ Autolinker.matchParser.MatchParser = Autolinker.Util.extend( Object, {
17271727
matcherRegex : (function() {
17281728
var twitterRegex = /(^|[^\w])@(\w{1,15})/, // For matching a twitter handle. Ex: @gregory_jacobs
17291729

1730-
hashtagRegex = /(^|[^\w])#(\w{1,15})/, // For matching a Hashtag. Ex: #games
1730+
hashtagRegex = /(^|[^\w])#(\w{1,139})/, // For matching a Hashtag. Ex: #games
17311731

17321732
emailRegex = /(?:[\-;:&=\+\$,\w\.]+@)/, // something@ for email addresses (a.k.a. local-part)
17331733
phoneRegex = /(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/, // ex: (123) 456-7890, 123 456 7890, 123-456-7890, etc.

dist/Autolinker.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "autolinker",
3-
"version": "0.18.0",
3+
"version": "0.18.1",
44
"description": "Utility to automatically link the URLs, email addresses, and Twitter handles in a given block of text/HTML",
55
"main": "dist/Autolinker.js",
66
"directories": {

src/matchParser/MatchParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Autolinker.matchParser.MatchParser = Autolinker.Util.extend( Object, {
102102
matcherRegex : (function() {
103103
var twitterRegex = /(^|[^\w])@(\w{1,15})/, // For matching a twitter handle. Ex: @gregory_jacobs
104104

105-
hashtagRegex = /(^|[^\w])#(\w{1,15})/, // For matching a Hashtag. Ex: #games
105+
hashtagRegex = /(^|[^\w])#(\w{1,139})/, // For matching a Hashtag. Ex: #games
106106

107107
emailRegex = /(?:[\-;:&=\+\$,\w\.]+@)/, // something@ for email addresses (a.k.a. local-part)
108108
phoneRegex = /(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/, // ex: (123) 456-7890, 123 456 7890, 123-456-7890, etc.

tests/AutolinkerSpec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,13 @@ describe( "Autolinker", function() {
950950
} );
951951

952952

953+
it( "should automatically link hashtags that are longer than 15 chars (original version of hashtag implementation limited to 15 chars, now it's at 139 chars)", function() {
954+
var result = twitterHashtagAutolinker.link( "my hashtag is #AHashtagThatIsWorthyOfMordorAndStuff these days" );
955+
956+
expect( result ).toBe( 'my hashtag is <a href="https://twitter.com/hashtag/AHashtagThatIsWorthyOfMordorAndStuff">#AHashtagThatIsWorthyOfMordorAndStuff</a> these days' );
957+
} );
958+
959+
953960
it( "should NOT automatically link a hashtag when the '#' belongs to part of another string", function() {
954961
var result = twitterHashtagAutolinker.link( "test as#df test" );
955962

0 commit comments

Comments
 (0)