diff --git a/addons/autolink/autolink.js b/addons/autolink/autolink.js index eb42dd39c..4b3939ebd 100644 --- a/addons/autolink/autolink.js +++ b/addons/autolink/autolink.js @@ -6,13 +6,13 @@ (function($){ var protocol_re = '(https?|ftp|news|telnet|irc|mms)://'; var domain_re = '(?:[\\w\\-]+\\.)+(?:[a-z]+)'; - var max_255_re = '(?:1[0-9]{2}|2[0-4][0-9]|25[0-5]|[1-9][0-9]?)'; + 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 path_re = '((?:/[\\w!"$-/:-@]+)*)'; var hash_re = '(?:#([\\w!-@]+))?'; - var url_regex = new RegExp('('+protocol_re+'('+domain_re+'|'+ip_re+')'+port_re+path_re+hash_re+')', 'ig'); + var url_regex = new RegExp('('+protocol_re+'('+domain_re+'|'+ip_re+'|localhost'+')'+port_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 bd57922e0..670a0a502 100644 --- a/addons/autolink/autolink.spec.html +++ b/addons/autolink/autolink.spec.html @@ -51,7 +51,7 @@ describe('AutoLink functionality', { value_of( $('#test5').contents().length ).should_be(3); }, "#test6 - complex example" : function() { - value_of( $('#test6 a').length ).should_be(6); + value_of( $('#test6 a').length ).should_be(7); value_of( $('#test6 a').eq(0).attr('href') ).should_be($('#test6 a').eq(0).text()); value_of( $('#test6 a').eq(2).parent().is('b') ).should_be_true(); value_of( $('#test6 > textarea > a').length ).should_be(0); @@ -95,6 +95,7 @@ describe('Autolink trigger', { Sayonara~ IP Test http://119.205.243.46 and MMS Link mms://xpressengine.com/a.wmv + http://localhost/some/path/file.ext Is it OK?
http://mygony.com