summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6940f5c)
No point in passing something on stack only to stash it
into the $ctx which holds most other parameters used for
rendering the HTML.
my $more = $ctx->{more};
if ($nr == 1) {
# $more cannot be true w/o $smsg being defined:
my $more = $ctx->{more};
if ($nr == 1) {
# $more cannot be true w/o $smsg being defined:
- my $upfx = $more ? '../'.mid_escape($ctx->{smsg}->mid).'/' : '';
- multipart_text_as_html(delete $ctx->{mime}, $upfx, $ctx);
+ $ctx->{mhref} = $more ? '../'.mid_escape($ctx->{smsg}->mid).'/'
+ : '';
+ multipart_text_as_html(delete $ctx->{mime}, $ctx);
${delete $ctx->{obuf}} .= '</pre><hr>';
} elsif ($more) {
++$ctx->{end_nr};
${delete $ctx->{obuf}} .= '</pre><hr>';
} elsif ($more) {
++$ctx->{end_nr};
my $next = $ibx->over->next_by_mid($ctx->{mid}, \$id, \$prev);
$ctx->{more} = $next ? [ $id, $prev, $next ] : undef;
return '' unless $smsg;
my $next = $ibx->over->next_by_mid($ctx->{mid}, \$id, \$prev);
$ctx->{more} = $next ? [ $id, $prev, $next ] : undef;
return '' unless $smsg;
- my $upfx = '../' . mid_escape($smsg->mid) . '/';
+ $ctx->{mhref} = '../' . mid_escape($smsg->mid) . '/';
my $mime = delete $smsg->{mime};
_msg_page_prepare_obuf($mime->header_obj, $ctx, $nr);
my $mime = delete $smsg->{mime};
_msg_page_prepare_obuf($mime->header_obj, $ctx, $nr);
- multipart_text_as_html($mime, $upfx, $ctx);
+ multipart_text_as_html($mime, $ctx);
${delete $ctx->{obuf}} .= '</pre><hr>';
}
${delete $ctx->{obuf}} .= '</pre><hr>';
}
}
sub multipart_text_as_html {
}
sub multipart_text_as_html {
- my (undef, $mhref, $ctx) = @_; # $mime = $_[0]
- $ctx->{mhref} = $mhref;
+ # ($mime, $ctx) = @_; # msg_iter will do "$_[0] = undef"
# scan through all parts, looking for displayable text
# scan through all parts, looking for displayable text
- msg_iter($_[0], \&add_text_body, $ctx, 1);
+ msg_iter($_[0], \&add_text_body, $_[1], 1);
qq{<div\nxmlns="http://www.w3.org/1999/xhtml">} .
qq(<pre\nstyle="white-space:pre-wrap">);
$ctx->{obuf} = \$s;
qq{<div\nxmlns="http://www.w3.org/1999/xhtml">} .
qq(<pre\nstyle="white-space:pre-wrap">);
$ctx->{obuf} = \$s;
- PublicInbox::View::multipart_text_as_html($mime, $href, $ctx);
+ $ctx->{mhref} = $href;
+ PublicInbox::View::multipart_text_as_html($mime, $ctx);
delete $ctx->{obuf};
$s .= '</pre></div></content></entry>';
}
delete $ctx->{obuf};
$s .= '</pre></div></content></entry>';
}
my $t = timeit(1, sub {
my $obuf = '';
$ctx->{obuf} = \$obuf;
my $t = timeit(1, sub {
my $obuf = '';
$ctx->{obuf} = \$obuf;
while (<$fh>) {
($cmt, $type) = split / /;
next if $type ne 'blob';
++$n;
$str = $git->cat_file($cmt);
$mime = PublicInbox::MIME->new($str);
while (<$fh>) {
($cmt, $type) = split / /;
next if $type ne 'blob';
++$n;
$str = $git->cat_file($cmt);
$mime = PublicInbox::MIME->new($str);
- PublicInbox::View::multipart_text_as_html($mime, '../', $ctx);
+ PublicInbox::View::multipart_text_as_html($mime, $ctx);