From 1e7fe3de7021427f8326a5f7710347035f7a63c5 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 5 Sep 2015 02:52:47 +0000 Subject: view: preliminary HTML search interface This hopefully makes it easier to find things without resorting to proprietary external services. --- lib/PublicInbox/Feed.pm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/Feed.pm') diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index 8fcb8d82..dbb80cad 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -123,19 +123,31 @@ sub emit_html_index { my $title = $feed_opts->{description} || ''; $title = PublicInbox::Hval->new_oneline($title)->as_html; my $atom_url = $feed_opts->{atomurl}; - my ($footer, $param, $last, $srch); + my ($footer, $param, $last); my $state = { ctx => $ctx, seen => {}, anchor_idx => 0 }; + my $srch = $ctx->{srch}; + + my $top = "$title (Atom feed)"; + + if ($srch) { + $top = qq{$top} . + qq{ } . + qq{} . + qq{} . + PublicInbox::View::PRE_WRAP; + } else { + $top = PublicInbox::View::PRE_WRAP . $top . "\n"; + } $fh->write("$title" . "" . - '' . PublicInbox::View::PRE_WRAP . - "$title (Atom feed)\n"); + "$top"); # if the 'r' query parameter is given, it is a legacy permalink # which we must continue supporting: my $cgi = $ctx->{cgi}; - if ($cgi && !$cgi->param('r') && ($srch = $ctx->{srch})) { + if ($cgi && !$cgi->param('r') && $srch) { $state->{srch} = $srch; $last = PublicInbox::View::emit_index_topics($state, $fh); $param = 'o'; -- cgit v1.2.3-24-ge0c7