From 41c999da8f25bbe822366ffe4ac65c953ea40679 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Sep 2022 08:17:09 +0000 Subject: [PATCH] view: _th_index_lite: avoid one s///, improve symmetry We can replace an expensive `s///' substitution with a simpler `chop'. Furthermore, we can delay the "\n" replacement to ensure it's on the same line of Perl code as the `' opening tag for readability. --- lib/PublicInbox/View.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 0fe645ca..3282d4f9 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -335,10 +335,10 @@ 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; + chop $attr; # remove "\n" $attr =~ s! (?:" )?!!s; # no point in dup subject $attr =~ s!]+>([^<]+)!$1!s; # no point linking to self - $rv .= "@ $attr"; + $rv .= "@ $attr\n"; if ($nr_c) { my $cmid = $children->[0] ? $children->[0]->{mid} : undef; $rv .= $pad . _skel_hdr($mapping, $cmid); -- 2.44.0