Skip to content

Commit

Permalink
Merge pull request #183 from westurner/fix_tweet_regex
Browse files Browse the repository at this point in the history
BUG: Match tweet #hashtag word boundaries
  • Loading branch information
christianvuerings committed Dec 18, 2014
2 parents e785efb + 0288b0a commit bd108f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
14 changes: 7 additions & 7 deletions jquery.lifestream.js
Original file line number Diff line number Diff line change
Expand Up @@ -2401,13 +2401,13 @@ $.fn.lifestream.feeds.tumblr = function( config, callback ) {
},
hash = function( t ) {
return t.replace(
/(^|[^\w'"]+)\#([a-zA-Z0-9ÅåÄäÖöØøÆæÉéÈèÜüÊêÛûÎî_]+)/g,
function( m, m1, m2 ) {
/(^|\B)#([a-zA-Z0-9ÅåÄäÖöØøÆæÉéÈèÜüÊêÛûÎî_]+)\b( |\r?\n|\r|$)/g,
function( m, m1, m2, m3 ) {
var elem = ($("<a></a>")
.attr("href", "https://twitter.com/hashtag/" + m2
+ "?src=hash")
.attr("href",
"https://twitter.com/hashtag/" + m2 + "?src=hash")
.text("#" + m2))[0].outerHTML;
return m1 + elem;
return m1 + elem + m3;
}
);
};
Expand Down Expand Up @@ -2436,10 +2436,10 @@ $.fn.lifestream.feeds.tumblr = function( config, callback ) {
"config": config,
"html": $.tmpl( template.posted, {
"tweet": linkify($('<div/>').html(status.text).text()),
"complete_url": 'http://twitter.com/' + config.user +
"complete_url": 'https://twitter.com/' + config.user +
"/status/" + status.id
} ),
"url": 'http://twitter.com/' + config.user
"url": 'https://twitter.com/' + config.user
});
}
callback(output);
Expand Down

0 comments on commit bd108f7

Please sign in to comment.