Recognize links inside parentheses/brackets
authorChip Black <bytex64@bytex64.net>
Thu, 13 Sep 2012 06:04:47 +0000 (01:04 -0500)
committerChip Black <bytex64@bytex64.net>
Thu, 13 Sep 2012 06:04:47 +0000 (01:04 -0500)
www/jssrc/blerg/Util.js

index 78081ed..2c76a61 100644 (file)
@@ -72,7 +72,7 @@ blerg.Util.blergFormat = function(text) {
         l = l.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
 
         // Turn HTTP URLs into links
-        l = l.replace(/(\s|^)(https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/([^\s"]*[^.!,;?()\s])?)?)/g, '$1<a href="$2">$2</a>');
+        l = l.replace(/(\s[()\[\]{}]?|^)(https?:\/\/[a-zA-Z0-9.-]*[a-zA-Z0-9](\/([^\s"]*[^.!,;?()\s])?)?)/g, '$1<a href="$2">$2</a>');
 
         // Turn markdown links into links
         l = blerg.Util.formatMarkdownLinks(l);