* [PATCH] linkify: match '~' (tilde) in URLs
@ 2016-05-01 1:49 Eric Wong
2016-05-01 2:12 ` [PATCH] linkify: match more URL characters [:,\$] and schemes Eric Wong
0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2016-05-01 1:49 UTC (permalink / raw)
To: meta
Tilde is common for some homepages: http://example.org/~user/
There's probably some other acceptable characters I'm missing.
---
lib/PublicInbox/Linkify.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/PublicInbox/Linkify.pm b/lib/PublicInbox/Linkify.pm
index 4eddedd..49ab311 100644
--- a/lib/PublicInbox/Linkify.pm
+++ b/lib/PublicInbox/Linkify.pm
@@ -17,7 +17,7 @@ use Digest::SHA qw/sha1_hex/;
my $SALT = rand;
my $LINK_RE = qr!\b((?:ftp|https?|nntp)://
[\@:\w\.-]+/
- ?[\@\w\+\&\?\.\%\;/#=-]*)!x;
+ ?[~\@\w\+\&\?\.\%\;/#=-]*)!x;
sub new { bless {}, shift }
--
EW
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] linkify: match more URL characters [:,\$] and schemes
2016-05-01 1:49 [PATCH] linkify: match '~' (tilde) in URLs Eric Wong
@ 2016-05-01 2:12 ` Eric Wong
0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2016-05-01 2:12 UTC (permalink / raw)
To: meta
Eric Wong <e@80x24.org> wrote:
> There's probably some other acceptable characters I'm missing.
Yup, just reading the rfc2396 parser in Ruby...
---------8<-----------
Subject: [PATCH] linkify: match more URL characters [:,\$] and schemes
Adding ':' (colon), ',' (comma), '$' (dollar sign) and
supporting TLS-enabled schemes: ftps, nntps variants as
well as gopher :D
---
lib/PublicInbox/Linkify.pm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/PublicInbox/Linkify.pm b/lib/PublicInbox/Linkify.pm
index 49ab311..25f0b48 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;
}
--
EW
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-01 2:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-01 1:49 [PATCH] linkify: match '~' (tilde) in URLs Eric Wong
2016-05-01 2:12 ` [PATCH] linkify: match more URL characters [:,\$] and schemes Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).