]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/View.pm
viewdiff: stricter highlighting and linkification check
[public-inbox.git] / lib / PublicInbox / View.pm
index 9b62ed3c3d954d76ab173c4c32bd561b85c62b30..f7a8ae3289337279c68c1e48e452eb9049be857f 100644 (file)
@@ -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!</b>\n!s;
-       $attr =~ s!<a\nhref.*</a> !!s; # no point in duplicating subject
+       $attr =~ s!<a\nhref.*</a> (?:&#34; )?!!s; # no point in dup subject
        $attr =~ s!<a\nhref=[^>]+>([^<]+)</a>!$1!s; # no point linking to self
        $rv .= "<b>@ $attr";
        if ($nr_c) {
@@ -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, ' &#34;');
                        $prev_subj = \@next_prev;
+                       $subj = join(' ', @subj);
                        $subj = ascii_html($subj);
                        obfuscate_addrs($obfs_ibx, $subj) if $obfs_ibx;
                        $href = mid_href($mid);