about summary refs log tree commit homepage
path: root/lib/PublicInbox/Linkify.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-05-01 01:54:07 +0000
committerEric Wong <e@80x24.org>2016-05-01 02:06:17 +0000
commitd5a6c485f52429cf6b1b18da3c4f47e2adc6edfc (patch)
tree0d6663f1c6125e16038c02450370175000b9ecdb /lib/PublicInbox/Linkify.pm
parentedf946775493b28c40baef507b83f015f828bb88 (diff)
downloadpublic-inbox-d5a6c485f52429cf6b1b18da3c4f47e2adc6edfc.tar.gz
Adding ':' (colon), ',' (comma), '$' (dollar sign) and
supporting TLS-enabled schemes: ftps, nntps variants as
well as gopher :D
Diffstat (limited to 'lib/PublicInbox/Linkify.pm')
-rw-r--r--lib/PublicInbox/Linkify.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/Linkify.pm b/lib/PublicInbox/Linkify.pm
index 49ab3116..25f0b48a 100644
--- a/lib/PublicInbox/Linkify.pm
+++ b/lib/PublicInbox/Linkify.pm
@@ -15,9 +15,9 @@ use warnings;
 use Digest::SHA qw/sha1_hex/;
 
 my $SALT = rand;
-my $LINK_RE = qr!\b((?:ftp|https?|nntp)://
+my $LINK_RE = qr!\b((?:ftps?|https?|nntps?|gopher)://
                  [\@:\w\.-]+/
-                 ?[~\@\w\+\&\?\.\%\;/#=-]*)!x;
+                 ?[,:~\$\@\w\+\&\?\.\%\;/#=-]*)!x;
 
 sub new { bless {}, shift }
 
@@ -28,8 +28,10 @@ sub linkify_1 {
                 my $end = '';
 
                 # it's fairly common to end URLs in messages with
-                # '.' or ';' to denote the end of a statement.
-                if ($url =~ s/(\.)\z// || $url =~ s/(;)\z//) {
+                # '.', ',' or ';' to denote the end of a statement;
+                # assume the intent was to end the statement/sentence
+                # in English
+                if ($url =~ s/([\.,;])\z//) {
                         $end = $1;
                 }