This commit is contained in:
Lei Zongmin 2012-10-18 13:40:52 +08:00
parent 800d732eb0
commit 2e6a27571c

View File

@ -195,7 +195,7 @@ this.makeHtml = function (text) {
return wholeMatch;
}
href = wholeMatch.replace(/^http:\/\/github.com\//, "https://github.com/")
var urlreg = /(https?|ftp|mms):\/\/([A-z0-9]+[_\-]?[A-z0-9]+\.)*[A-z0-9]+\-?[A-z0-9]+\.[A-z]{2,}(\/.*)*\/?/;
var urlreg = /(https?|ftp|mms):\/\/((([A-z0-9]+[_\-]?[A-z0-9]+\.)*[A-z0-9]+\-?[A-z0-9]+\.[A-z]{2,})|(([0-9]{1,3}\.){3}[0-9]{1,3}))(\/.*)*\/?/;
return "<a href='" + (urlreg.test(href)?href:("http://www.cnodejs.org"+href)) + "'>" + wholeMatch + "</a>";
});
text = text.replace(/[a-z0-9_\-+=.]+@[a-z0-9\-]+(\.[a-z0-9-]+)+/ig, function(wholeMatch){return "<a href='mailto:" + wholeMatch + "'>" + wholeMatch + "</a>";});