From dfdaf74a2ab6d694315d8f636e3771a7a7934f3f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 23 Jun 2017 22:42:34 +0000 Subject: linkify: handle URLs in parenthesized statements Sometimes, URLs exist at the end of parethesized statements, and we shouldn't unnecessarily capture that. (example: https://public-inbox.org/ruby-core/20170623032722.GA8124@dcvr/) --- t/linkify.t | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/linkify.t b/t/linkify.t index 99acf17d..041c15c7 100644 --- a/t/linkify.t +++ b/t/linkify.t @@ -14,6 +14,16 @@ use PublicInbox::Linkify; is($s, qq($u.), 'trailing period not in URL'); } +# handle URLs in parenthesized statements +{ + my $l = PublicInbox::Linkify->new; + my $u = 'http://example.com/'; + my $s = "(see: $u)"; + $s = $l->linkify_1($s); + $s = $l->linkify_2($s); + is($s, qq{(see: $u)}, 'trailing ) not in URL'); +} + { my $l = PublicInbox::Linkify->new; my $u = 'http://example.com/url-with-trailing-semicolon'; -- cgit v1.2.3-24-ge0c7