]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Linkify.pm
Merge branch 'thread-view-skel'
[public-inbox.git] / lib / PublicInbox / Linkify.pm
index 4eddedd03646750783be13782bc8ce3cd63dced8..25f0b48a34d9b2329b97d857797476f474e7632a 100644 (file)
@@ -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;
                }