Skip to content

Commit

Permalink
Merge branch 'PLPeeters-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjacobs committed Jun 26, 2015
2 parents 07f5b1b + 358863f commit 3961ba6
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/Autolinker.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

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

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

emailRegex = /(?:[\-;:&=\+\$,\w\.]+@)/, // something@ for email addresses (a.k.a. local-part)
phoneRegex = /(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/, // ex: (123) 456-7890, 123 456 7890, 123-456-7890, etc.
Expand Down
4 changes: 2 additions & 2 deletions dist/Autolinker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "autolinker",
"version": "0.18.0",
"version": "0.18.1",
"description": "Utility to automatically link the URLs, email addresses, and Twitter handles in a given block of text/HTML",
"main": "dist/Autolinker.js",
"directories": {
Expand Down
2 changes: 1 addition & 1 deletion src/matchParser/MatchParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Autolinker.matchParser.MatchParser = Autolinker.Util.extend( Object, {
matcherRegex : (function() {
var twitterRegex = /(^|[^\w])@(\w{1,15})/, // For matching a twitter handle. Ex: @gregory_jacobs

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

emailRegex = /(?:[\-;:&=\+\$,\w\.]+@)/, // something@ for email addresses (a.k.a. local-part)
phoneRegex = /(?:\+?\d{1,3}[-\s.])?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]\d{4}/, // ex: (123) 456-7890, 123 456 7890, 123-456-7890, etc.
Expand Down
7 changes: 7 additions & 0 deletions tests/AutolinkerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,13 @@ describe( "Autolinker", function() {
} );


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() {
var result = twitterHashtagAutolinker.link( "my hashtag is #AHashtagThatIsWorthyOfMordorAndStuff these days" );

expect( result ).toBe( 'my hashtag is <a href="https://twitter.com/hashtag/AHashtagThatIsWorthyOfMordorAndStuff">#AHashtagThatIsWorthyOfMordorAndStuff</a> these days' );
} );


it( "should NOT automatically link a hashtag when the '#' belongs to part of another string", function() {
var result = twitterHashtagAutolinker.link( "test as#df test" );

Expand Down

0 comments on commit 3961ba6

Please sign in to comment.