Re-imported the regular expression for URLs from AntvilleLib's String.activateURLs() method

This commit is contained in:
Tobi Schäfer 2008-05-12 15:35:38 +00:00
parent 7ce924ead0
commit 4522c3b308

View file

@ -476,10 +476,15 @@ Story.prototype.macro_filter = function(value, param) {
Story.prototype.url_filter = function(value, param, mode) {
param.limit || (param.limit = 50);
// FIXME: Check query strings et al.
// FIXME: Strange output with <a href=antville.org>...</a> (no quotes)
var re = /(^|\/>|\s+)([\w+-_]+:\/\/[^\s]+?)([\.,;:\)\]\"]?)(?=[\s<]|$)/gim;
// FIXME: The first RegExp has troubles with <a href=http://... (no quotes)
//var re = /(^|\/>|\s+)([\w+-_]+:\/\/[^\s]+?)([\.,;:\)\]\"]?)(?=[\s<]|$)/gim;
var re = /(^|\/>|\s+)([fhtpsr]+:\/\/[^\s]+?)([\.,;:\)\]\"]?)(?=[\s<]|$)/gim
return value.replace(re, function(str, head, url, tail) {
res.debug(str);
res.debug("head: "+head);
res.debug("url : "+url);
res.debug("tail: "+tail);
res.debug("<hr>")
res.push();
res.write(head);
if (mode === "plain") {