From ba91cef345da64ecda294f8f60b70b7de73ea1ec Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Jul 2015 20:52:33 +0000 Subject: view: reduce empty , use "id" instead of "name" attributes This is probably more compliant, and saves us a few bytes on the uncompressed HTML. --- lib/PublicInbox/View.pm | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 3695bb2a..bc4c7ac7 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -54,8 +54,8 @@ sub index_entry { my $header_obj = $mime->header_obj; my $mid_raw = $header_obj->header_raw('Message-ID'); - my $name = anchor_for($mid_raw); - $seen->{$name} = "#$name"; # save the anchor for later + my $id = anchor_for($mid_raw); + $seen->{$id} = "#$id"; # save the anchor for later my $mid = PublicInbox::Hval->new_msgid($mid_raw); my $from = PublicInbox::Hval->new_oneline($mime->header('From'))->raw; @@ -78,13 +78,9 @@ sub index_entry { } $ts = POSIX::strftime($fmt, gmtime($ts)); - $rv .= "$pfx" . - "" . - "$subj\n$pfx"; - + $rv .= "$pfx$subj\n$pfx"; $rv .= "- by $from @ $ts - "; - - $rv .= "next"; + $rv .= "next"; if ($prev >= 0) { $rv .= "/prev"; } @@ -153,7 +149,7 @@ sub index_entry { } $rv .= " parent"; } - $rv .= " threadlink"; + $rv .= " threadlink"; $rv . "\n\n"; } @@ -269,7 +265,7 @@ sub add_text_body_full { my $cur = $1; my @lines = split(/\n/, $cur); if (@lines > MAX_INLINE_QUOTED) { - "$cur"; + "$cur"; } else { $cur; } @@ -382,7 +378,7 @@ sub anchor_for { my ($msgid) = @_; $msgid =~ s/\A\s*?\s*\z//; - Digest::SHA::sha1_hex($msgid); + 'm' . Digest::SHA::sha1_hex($msgid); } 1; -- cgit v1.2.3-24-ge0c7