]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: fix linkification and quote-folding conflicts
authorEric Wong <e@80x24.org>
Wed, 4 Mar 2015 20:50:34 +0000 (20:50 +0000)
committerEric Wong <e@80x24.org>
Wed, 4 Mar 2015 20:50:34 +0000 (20:50 +0000)
We can't add newlines to links, unfortunately, because
quote-folding is line-based and (being regexp-based) needs
to happen after linkification.

lib/PublicInbox/View.pm

index 3bb385376ba9d481bbc877fe340ab45b0a433055..3695bb2aafe8bc54a6e292aa28b52adea092e13c 100644 (file)
@@ -221,7 +221,9 @@ sub add_filename_line {
 my $LINK_RE = qr!\b((?:ftp|https?|nntp)://[@\w\+\&\?\.\%\;/#=-]+)!;
 
 sub linkify {
-       $_[0] =~ s!$LINK_RE!<a\nhref="$1"\n>$1</a>!g;
+       # no newlines added here since it'd break the splitting we do
+       # to fold quotes
+       $_[0] =~ s!$LINK_RE!<a href="$1">$1</a>!g;
 }
 
 sub add_text_body_short {