use PublicInbox::View;
use PublicInbox::MID qw(mid2path mid_clean);
use Email::MIME;
+require PublicInbox::Git;
our $LIM = 50;
sub sres_top_html {
$total = $mset->get_matches_estimated;
};
my $err = $@;
- my $res = html_start($q, $ctx) . PublicInbox::View::PRE_WRAP;
+ my $res = html_start($q, $ctx) . '<pre>';
if ($err) {
$code = 400;
$res .= err_txt($err) . "</pre><hr /><pre>" . foot($ctx);
my $x = $q->{x};
return sub { adump($_[0], $mset, $q, $ctx) } if ($x eq 'A');
- $res .= search_nav_top($mset, $q);
+ $res .= search_nav_top($mset, $q) . "\n\n";
if ($x eq 't') {
return sub { tdump($_[0], $res, $mset, $q, $ctx) };
}
- $res .= "\n\n";
dump_mset(\$res, $mset);
- $res .= search_nav_bot($mset, $q) . "\n\n" . foot($ctx);
+ $res .= '</pre>' . search_nav_bot($mset, $q) .
+ "\n\n" . foot($ctx);
}
$res .= "</pre></body></html>";
my $x = $q->{x};
if ($x eq '') {
my $t = $q->qs_html(x => 't');
- $rv .= qq{<b>summary</b>|};
- $rv .= qq{<a\nhref="?$t">threaded</a>}
+ $rv .= qq{<b>summary</b>|<a\nhref="?$t">threaded</a>}
} elsif ($q->{x} eq 't') {
my $s = $q->qs_html(x => '');
- $rv .= qq{<a\nhref="?$s">summary</a>|};
- $rv .= qq{<b>threaded</b>};
+ $rv .= qq{<a\nhref="?$s">summary</a>|<b>threaded</b>};
}
my $A = $q->qs_html(x => 'A', r => undef);
- $rv .= qq{|<a\nhref="?$A">Atom</a>};
- $rv .= ']';
+ $rv .= qq{|<a\nhref="?$A">Atom feed</a>]};
}
sub search_nav_bot {
$th->order(*PublicInbox::View::rsort_ts);
}
- require PublicInbox::GitCatFile;
- my $git = PublicInbox::GitCatFile->new($ctx->{git_dir});
+ my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir});
my $state = { ctx => $ctx, anchor_idx => 0, pct => \%pct };
$ctx->{searchview} = 1;
tdump_ent($fh, $git, $state, $_, 0) for $th->rootset;
- $git = undef;
Email::Address->purge_cache;
$fh->write(search_nav_bot($mset, $q). "\n\n" .
sub adump {
my ($cb, $mset, $q, $ctx) = @_;
my $fh = $cb->([ 200, ['Content-Type' => 'application/atom+xml']]);
- require PublicInbox::GitCatFile;
- my $git = PublicInbox::GitCatFile->new($ctx->{git_dir});
+ my $git = $ctx->{git} ||= PublicInbox::Git->new($ctx->{git_dir});
my $feed_opts = PublicInbox::Feed::get_feedopts($ctx);
my $x = PublicInbox::Hval->new_oneline($q->{q})->as_html;
$x = qq{$x - search results};
$x = mid2path($x);
PublicInbox::Feed::add_to_feed($feed_opts, $fh, $x, $git);
}
- $git = undef;
PublicInbox::Feed::end_feed($fh);
}