diff --git a/addons/autolink/autolink.js b/addons/autolink/autolink.js index eea4ecf52..a6744c2bf 100644 --- a/addons/autolink/autolink.js +++ b/addons/autolink/autolink.js @@ -9,10 +9,11 @@ var max_255_re = '(?:1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9]?[0-9])'; var ip_re = '(?:'+max_255_re+'\\.){3}'+max_255_re; var port_re = '(?::([0-9]+))?'; + var user_re = '(?:/~[\\w-]+)?'; var path_re = '((?:/[\\w!"$-/:-@]+)*)'; var hash_re = '(?:#([\\w!-@]+))?'; - var url_regex = new RegExp('('+protocol_re+'('+domain_re+'|'+ip_re+'|localhost'+')'+port_re+path_re+hash_re+')', 'ig'); + var url_regex = new RegExp('('+protocol_re+'('+domain_re+'|'+ip_re+'|localhost'+')'+port_re+user_re+path_re+hash_re+')', 'ig'); var AutoLink = xe.createPlugin("autolink", { targets : [], diff --git a/addons/autolink/autolink.spec.html b/addons/autolink/autolink.spec.html index aea13835c..b4873678f 100644 --- a/addons/autolink/autolink.spec.html +++ b/addons/autolink/autolink.spec.html @@ -60,6 +60,10 @@ describe('AutoLink functionality', { "#test9 - don't include parenthesis" : function() { value_of( $('#test9 a').length ).should_be(1); value_of( $('#test9 a').attr('href') ).should_be('http://www.naver.com'); + }, + "#test10 - include tild" : function() { + value_of( $('#test10 a').length ).should_be(1); + value_of( $('#test10 a').attr('href') ).should_be('http://www.xpressengine.com:8000/~user/?mid=def'); } }); @@ -102,6 +106,7 @@ describe('Autolink trigger', {