Skip to content

Commit

Permalink
Add support to link hashtags to either Twitter or Facebook.
Browse files Browse the repository at this point in the history
  • Loading branch information
gregjacobs committed Mar 30, 2015
1 parent 63afab7 commit 2701222
Show file tree
Hide file tree
Showing 10 changed files with 521 additions and 213 deletions.
1 change: 1 addition & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ module.exports = function(grunt) {
'src/matchParser/MatchValidator.js',
'src/match/Match.js',
'src/match/Email.js',
'src/match/Hashtag.js',
'src/match/Phone.js',
'src/match/Twitter.js',
'src/match/Url.js'
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ providing an Object as the second parameter to [Autolinker.link()](http://gregja
- [twitter](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-twitter) : Boolean<br />
`true` to have Twitter handles auto-linked, `false` to skip auto-linking of
Twitter handles. Defaults to `true`.<br /><br />
- [hashtag](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-hashtag) : Boolean<br />
`true` to have hashtags auto-linked, `false` to skip auto-linking of
hashtags. Defaults to `false`.<br /><br />
- [hashtag](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-hashtag) : Boolean/String<br />
A string for the service name to have hashtags auto-linked to. Supported
values at this time are 'twitter' and 'facebook'. Pass `false` to skip
auto-linking of hashtags. Defaults to `false`.<br /><br />
- [replaceFn](http://gregjacobs.github.io/Autolinker.js/docs/#!/api/Autolinker-cfg-replaceFn) : Function<br />
A function to use to programmatically make replacements of matches in the
input string, one at a time. See the section
Expand Down Expand Up @@ -228,9 +229,9 @@ var linkedText = Autolinker.link( input, {

case 'phone' :
var phoneNumber = match.getPhoneNumber();
console.log( twitterHandle );
console.log( phoneNumber );

return '<a href="http://newplace.to.link.twitter.handles.to/">' + twitterHandle + '</a>';
return '<a href="http://newplace.to.link.phone.numbers.to/">' + phoneNumber + '</a>';

case 'twitter' :
var twitterHandle = match.getTwitterHandle();
Expand Down
Loading

0 comments on commit 2701222

Please sign in to comment.