From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 0847A1F610 for ; Sat, 4 Apr 2020 08:03:21 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 5/5] view: inline flush_quote sub Date: Sat, 4 Apr 2020 08:03:19 +0000 Message-Id: <20200404080319.3293-6-e@yhbt.net> In-Reply-To: <20200404080319.3293-1-e@yhbt.net> References: <20200404080319.3293-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: No point in having an extra sub for a short, commonly called function in the same file. --- lib/PublicInbox/View.pm | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 12ef6431..1e53d8dc 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -482,17 +482,6 @@ sub multipart_text_as_html { msg_iter($_[0], \&add_text_body, $_[1], 1); } -sub flush_quote { - my ($s, $l, $quot) = @_; - - my $rv = $l->to_html($$quot); - - # we use a here to allow users to specify their own - # color for quoted text - $$quot = undef; - $$s .= qq() . $rv . '' -} - sub attach_link ($$$$;$) { my ($ctx, $ct, $p, $fn, $err) = @_; my ($part, $depth, @idx) = @$p; @@ -587,14 +576,18 @@ sub add_text_body { # callback for msg_iter my $l = $ctx->{-linkify} //= PublicInbox::Linkify->new; foreach my $cur (@sections) { if ($cur =~ /\A>/) { - flush_quote($rv, $l, \$cur); + # we use a here to allow users to specify + # their own color for quoted text + $$rv .= qq(); + $$rv .= $l->to_html($cur); + $$rv .= ''; } elsif ($diff) { flush_diff($ctx, \$cur); } else { # regular lines, OK $$rv .= $l->to_html($cur); - $cur = undef; } + $cur = undef; } obfuscate_addrs($ibx, $$rv) if $ibx->{obfuscate};