mirror of
https://github.com/cnodejs/nodeclub.git
synced 2026-02-01 16:34:28 +00:00
Merge pull request #96 from leizongmin/master
修正无法正确解析帖子内容中 http://127.0.0.1 这类IP地址的链接
This commit is contained in:
commit
9bebbdf594
@ -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>";});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user