about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-10-24 00:12:37 +0000
committerEric Wong <e@80x24.org>2019-10-28 10:49:08 +0000
commitd2786235a289a0286d96a9b853b7a0a30a6f6b5a (patch)
tree67cb435dca40edf8ba7e7d24ef28c92a5cb70314 /lib/PublicInbox/View.pm
parent2394cb0bdc671605729b5a4c578ef4cd3b9813fd (diff)
downloadpublic-inbox-d2786235a289a0286d96a9b853b7a0a30a6f6b5a.tar.gz
view: move '<' and '>' outside <a>
Browsers may underline '<' and '>' in links, which may be
confused with '≤' and '≥'.  So have the Message-ID header
display follow what we do with In-Reply-To headers and move the
"&lt;" and "&gt;" outside of <a> in the HTML.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 1aa014fd..855ad017 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -630,7 +630,6 @@ sub _msg_html_prepare {
         my $obfs_ibx = $ctx->{-obfs_ibx};
         my $rv = '';
         my $mids = mids($hdr);
-        my $multiple = scalar(@$mids) > 1; # zero, one, infinity
         if ($nr == 0) {
                 if ($more) {
                         $rv .=
@@ -686,18 +685,19 @@ sub _msg_html_prepare {
                 $rv .= "Date: $v\n";
         }
         $ctx->{-title_html} = join(' - ', @title);
-        foreach (@$mids) {
-                my $mid = PublicInbox::Hval->new_msgid($_) ;
+        if (scalar(@$mids) == 1) { # common case
+                my $mid = PublicInbox::Hval->new_msgid($mids->[0]);
                 my $mhtml = $mid->as_html;
-                if ($multiple) {
+                $rv .= "Message-ID: &lt;$mhtml&gt; ";
+                $rv .= "(<a\nhref=\"raw\">raw</a>)\n";
+        } else {
+                foreach (@$mids) {
+                        my $mid = PublicInbox::Hval->new_msgid($_);
+                        my $mhtml = $mid->as_html;
                         my $href = $mid->{href};
                         $rv .= "Message-ID: ";
-                        $rv .= "<a\nhref=\"../$href/\">";
-                        $rv .= "&lt;$mhtml&gt;</a> ";
+                        $rv .= "&lt;<a\nhref=\"../$href/\">$mhtml</a>&gt; ";
                         $rv .= "(<a\nhref=\"../$href/raw\">raw</a>)\n";
-                } else {
-                        $rv .= "Message-ID: &lt;$mhtml&gt; ";
-                        $rv .= "(<a\nhref=\"raw\">raw</a>)\n";
                 }
         }
         $rv .= _parent_headers($hdr, $over);