lib/PublicInbox/View.pm | 25 ++++++++++++++++++++++--- diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index e43872037ebc493d1c488b14ee1b91b8031f9299..b2f2a7fd5851a404965a6b3ace5ffb8d1c318efc 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -172,12 +172,22 @@ } my $irp = $header_obj->header_raw('In-Reply-To'); if (defined $irp) { - $irp = PublicInbox::Hval->new_msgid($irp); - my $html = $irp->as_html; - my $href = $irp->as_href; + my $v = PublicInbox::Hval->new_msgid(my $tmp = $irp); + my $html = $v->as_html; + my $href = $v->as_href; $rv .= "In-Reply-To: <"; $rv .= "$html>\n"; } + + my $refs = $header_obj->header_raw('References'); + if ($refs) { + $refs =~ s/\s*\Q$irp\E\s*// if (defined $irp); + my @refs = ($refs =~ /<([^>]+)>/g); + if (@refs) { + $rv .= 'References: '. linkify_refs(@refs) . "\n"; + } + } + $rv .= "\n"; ("". join(' - ', @title) . @@ -211,6 +221,15 @@ my $cc = uri_escape(join(',', values %cc)); my $href = "mailto:$to?In-Reply-To=$irp&Cc=${cc}&Subject=$subj"; '<a href="' . ascii_html($href) . '">reply</a>'; +} + +sub linkify_refs { + join(' ', map { + my $v = PublicInbox::Hval->new_msgid($_); + my $html = $v->as_html; + my $href = $v->as_href; + "<<a href=\"$href.html\">$html</a>>"; + } @_); } 1;