* [PATCH 5/5] view: inline flush_quote sub
2020-04-04 8:03 6% [PATCH 0/5] view*: minor cleanups and fixes Eric Wong
@ 2020-04-04 8:03 7% ` Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-04-04 8:03 UTC (permalink / raw)
To: meta
No point in having an extra sub for a short, commonly
called function in the same file.
---
lib/PublicInbox/View.pm | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 12ef6431..1e53d8dc 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -482,17 +482,6 @@ sub multipart_text_as_html {
msg_iter($_[0], \&add_text_body, $_[1], 1);
}
-sub flush_quote {
- my ($s, $l, $quot) = @_;
-
- my $rv = $l->to_html($$quot);
-
- # we use a <span> here to allow users to specify their own
- # color for quoted text
- $$quot = undef;
- $$s .= qq(<span\nclass="q">) . $rv . '</span>'
-}
-
sub attach_link ($$$$;$) {
my ($ctx, $ct, $p, $fn, $err) = @_;
my ($part, $depth, @idx) = @$p;
@@ -587,14 +576,18 @@ sub add_text_body { # callback for msg_iter
my $l = $ctx->{-linkify} //= PublicInbox::Linkify->new;
foreach my $cur (@sections) {
if ($cur =~ /\A>/) {
- flush_quote($rv, $l, \$cur);
+ # we use a <span> here to allow users to specify
+ # their own color for quoted text
+ $$rv .= qq(<span\nclass="q">);
+ $$rv .= $l->to_html($cur);
+ $$rv .= '</span>';
} elsif ($diff) {
flush_diff($ctx, \$cur);
} else {
# regular lines, OK
$$rv .= $l->to_html($cur);
- $cur = undef;
}
+ $cur = undef;
}
obfuscate_addrs($ibx, $$rv) if $ibx->{obfuscate};
^ permalink raw reply related [relevance 7%]
* [PATCH 0/5] view*: minor cleanups and fixes
@ 2020-04-04 8:03 6% Eric Wong
2020-04-04 8:03 7% ` [PATCH 5/5] view: inline flush_quote sub Eric Wong
0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-04-04 8:03 UTC (permalink / raw)
To: meta
Just a few odds and ends which bother me when reading
the code or render HTML result.
Eric Wong (5):
view: note we assume UTF-8 on unknown encodings
view: use defined-or operator to simplify checks
view: dedupe_subject: allow "0" is a valid Subject
viewdiff: reduce sub parameter count
view: inline flush_quote sub
lib/PublicInbox/View.pm | 37 +++++++++++++++----------------------
lib/PublicInbox/ViewDiff.pm | 21 ++++++++++++---------
2 files changed, 27 insertions(+), 31 deletions(-)
^ permalink raw reply [relevance 6%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-04-04 8:03 6% [PATCH 0/5] view*: minor cleanups and fixes Eric Wong
2020-04-04 8:03 7% ` [PATCH 5/5] view: inline flush_quote sub Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).