Added option to escape URL from being linked automatically by prefixing it with a exclamation mark: !http://antville.org

This commit is contained in:
Tobi Schäfer 2008-05-13 14:48:54 +00:00
parent 9923a0e0e7
commit e8c6ca163c

View file

@ -479,8 +479,11 @@ Story.prototype.url_filter = function(value, param, mode) {
param.limit || (param.limit = 50);
// 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
var re = /(^|\/>|\s+)([!fhtpsr]+:\/\/[^\s]+?)([\.,;:\)\]\"]?)(?=[\s<]|$)/gim
return value.replace(re, function(str, head, url, tail) {
if (url.startsWith("!")) {
return head + url.substring(1) + tail;
}
res.push();
res.write(head);
if (mode === "plain") {