X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FView.pm;h=e42fb3624bfc622a2310b9e8c14ead0871f02b15;hb=8d1b87f498ea47bb752ea24900372df192d322fb;hp=9b62ed3c3d954d76ab173c4c32bd561b85c62b30;hpb=4bebfa0c80ad7f4596a7dca98b39121470a42af0;p=public-inbox.git diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 9b62ed3c..e42fb362 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -243,7 +243,7 @@ sub index_entry { # scan through all parts, looking for displayable text $ctx->{mhref} = $mhref; $ctx->{obuf} = \$rv; - msg_iter($mime, \&add_text_body, $ctx, 1); + $mime->each_part(\&add_text_body, $ctx, 1); delete $ctx->{obuf}; # add the footer @@ -322,7 +322,7 @@ sub _th_index_lite { my $s_s = nr_to_s($nr_s, 'sibling', 'siblings'); my $s_c = nr_to_s($nr_c, 'reply', 'replies'); $attr =~ s!\n\z!\n!s; - $attr =~ s! !!s; # no point in duplicating subject + $attr =~ s! (?:" )?!!s; # no point in dup subject $attr =~ s!]+>([^<]+)!$1!s; # no point linking to self $rv .= "@ $attr"; if ($nr_c) { @@ -474,10 +474,10 @@ sub thread_html_i { # PublicInbox::WwwStream::getline callback } sub multipart_text_as_html { - # ($mime, $ctx) = @_; # msg_iter will do "$_[0] = undef" + # ($mime, $ctx) = @_; # each_part may do "$_[0] = undef" # scan through all parts, looking for displayable text - msg_iter($_[0], \&add_text_body, $_[1], 1); + $_[0]->each_part(\&add_text_body, $_[1], 1); } sub attach_link ($$$$;$) { @@ -515,11 +515,11 @@ EOF undef; } -sub add_text_body { # callback for msg_iter +sub add_text_body { # callback for each_part my ($p, $ctx) = @_; my $upfx = $ctx->{mhref}; my $ibx = $ctx->{-inbox}; - # $p - from msg_iter: [ Email::MIME, depth, @idx ] + # $p - from each_part: [ Email::MIME-like, depth, @idx ] my ($part, $depth, @idx) = @$p; my $ct = $part->content_type || 'text/plain'; my $fn = $part->filename; @@ -536,11 +536,14 @@ sub add_text_body { # callback for msg_iter # always support diff-highlighting, but we can't linkify hunk # headers for solver unless some coderepo are configured: my $diff; - if ($s =~ /^(?:diff|---|\+{3}) /ms) { + if ($s =~ /^--- [^\n]+\n\+{3} [^\n]+\n@@ /ms) { # diffstat anchors do not link across attachments or messages: $idx[0] = $upfx . $idx[0] if $upfx ne ''; $ctx->{-apfx} = join('/', @idx); - $ctx->{-anchors} = {}; # attr => filename + + # do attr => filename mappings for diffstats in git diffs: + $ctx->{-anchors} = {} if $s =~ /^diff --git /sm; + $diff = 1; delete $ctx->{-long_path}; my $spfx; @@ -1096,6 +1099,7 @@ sub dump_topics { my @next_prev = @subj; # full copy my $omit = dedupe_subject($prev_subj, \@subj, ' "'); $prev_subj = \@next_prev; + $subj = join(' ', @subj); $subj = ascii_html($subj); obfuscate_addrs($obfs_ibx, $subj) if $obfs_ibx; $href = mid_href($mid);