From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS8972 188.138.9.0/24 X-Spam-Status: No, score=-1.7 required=3.0 tests=AWL,BAYES_00,RCVD_IN_XBL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: meta@public-inbox.org Received: from 80x24.org (atlantic480.us.unmetered.com [188.138.9.49]) by dcvr.yhbt.net (Postfix) with ESMTP id 43E18200F5 for ; Fri, 4 Sep 2015 02:18:30 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 7/7] view: do not generate anchors in thread views Date: Fri, 4 Sep 2015 02:18:11 +0000 Message-Id: <1441333091-32421-8-git-send-email-e@80x24.org> In-Reply-To: <1441333091-32421-1-git-send-email-e@80x24.org> References: <1441333091-32421-1-git-send-email-e@80x24.org> List-Id: They're unused, and they can have namespace conflicts if there's multiple full messages in the thread view. --- lib/PublicInbox/View.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 65ef1e7..bd174b1 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -256,7 +256,7 @@ sub multipart_text_as_html { # scan through all parts, looking for displayable text $mime->walk_parts(sub { my ($part) = @_; - $rv .= add_text_body($enc, $part, \$part_nr, $full_pfx); + $rv .= add_text_body($enc, $part, \$part_nr, $full_pfx, 1); }); $mime->body_set(''); $rv; @@ -308,7 +308,7 @@ sub linkify_2 { } sub flush_quote { - my ($quot, $n, $part_nr, $full_pfx, $final) = @_; + my ($quot, $n, $part_nr, $full_pfx, $final, $do_anchor) = @_; if ($full_pfx) { if (!$final && scalar(@$quot) <= MAX_INLINE_QUOTED) { @@ -342,18 +342,18 @@ sub flush_quote { } else { # show everything in the full version with anchor from # short version (see above) - my $nr = ++$$n; - my $rv = ""; my %l; - $rv .= join('', map { linkify_1(\%l, $_) } @$quot); + my $rv .= join('', map { linkify_1(\%l, $_) } @$quot); @$quot = (); $rv = ascii_html($rv); + return linkify_2(\%l, $rv) unless $do_anchor; + my $nr = ++$$n; "" . linkify_2(\%l, $rv); } } sub add_text_body { - my ($enc_msg, $part, $part_nr, $full_pfx) = @_; + my ($enc_msg, $part, $part_nr, $full_pfx, $do_anchor) = @_; return '' if $part->subparts; my $ct = $part->content_type; @@ -383,7 +383,7 @@ sub add_text_body { # show the previously buffered quote inline if (scalar @quot) { $s .= flush_quote(\@quot, \$n, $$part_nr, - $full_pfx, 0); + $full_pfx, 0, $do_anchor); } # regular line, OK @@ -395,7 +395,10 @@ sub add_text_body { push @quot, $cur; } } - $s .= flush_quote(\@quot, \$n, $$part_nr, $full_pfx, 1) if scalar @quot; + if (scalar @quot) { + $s .= flush_quote(\@quot, \$n, $$part_nr, $full_pfx, 1, + $do_anchor); + } $s .= "\n" unless $s =~ /\n\z/s; ++$$part_nr; $s; -- EW