diff options
author | Eric Wong <e@80x24.org> | 2015-09-05 02:52:47 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-09-05 03:02:35 +0000 |
commit | 1e7fe3de7021427f8326a5f7710347035f7a63c5 (patch) | |
tree | a536b46fafda4b1347b5907bf1dd795bfd37d76d /lib/PublicInbox/Feed.pm | |
parent | 68d0ef45113ad2761e4f065250f329a5f52eb5f0 (diff) | |
download | public-inbox-1e7fe3de7021427f8326a5f7710347035f7a63c5.tar.gz |
This hopefully makes it easier to find things without resorting to proprietary external services.
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 20 |
1 files changed, 16 insertions, 4 deletions
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 = "<b>$title</b> (<a\nhref=\"$atom_url\">Atom feed</a>)"; + + if ($srch) { + $top = qq{<form\naction=""><tt>$top} . + qq{ <input\nname=q\ntype=text />} . + qq{<input\ntype=submit\nvalue=search />} . + qq{</tt></form>} . + PublicInbox::View::PRE_WRAP; + } else { + $top = PublicInbox::View::PRE_WRAP . $top . "\n"; + } $fh->write("<html><head><title>$title</title>" . "<link\nrel=alternate\ntitle=\"Atom feed\"\n". "href=\"$atom_url\"\ntype=\"application/atom+xml\"/>" . - '</head><body>' . PublicInbox::View::PRE_WRAP . - "<b>$title</b> (<a\nhref=\"$atom_url\">Atom feed</a>)\n"); + "</head><body>$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'; |