]> Sergey Matveev's repositories - public-inbox.git/commitdiff
view: inline flush_quote sub
authorEric Wong <e@yhbt.net>
Sat, 4 Apr 2020 08:03:19 +0000 (08:03 +0000)
committerEric Wong <e@yhbt.net>
Sat, 4 Apr 2020 23:37:29 +0000 (23:37 +0000)
No point in having an extra sub for a short, commonly
called function in the same file.

lib/PublicInbox/View.pm

index 12ef643110348e779da226801ed420868993e351..1e53d8dc2ae133d7e58ac898021c632e618bb597 100644 (file)
@@ -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 <span> here to allow users to specify their own
-       # color for quoted text
-       $$quot = undef;
-       $$s .= qq(<span\nclass="q">) . $rv . '</span>'
-}
-
 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 <span> here to allow users to specify
+                       # their own color for quoted text
+                       $$rv .= qq(<span\nclass="q">);
+                       $$rv .= $l->to_html($cur);
+                       $$rv .= '</span>';
                } 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};