X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FFeed.pm;h=c16c417a099e9e6b88bdc94e5f9897e37293380a;hb=2c69f7bc34a2b12dc7f55e2bb24fa28565f24f03;hp=ddc1e3c14f8b3fc4860f73363ac10cf8c6f84efe;hpb=0c28e937c80f3134898bc41f10bc9de350851944;p=public-inbox.git diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index ddc1e3c1..c16c417a 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -34,6 +34,33 @@ sub generate_html_index { sub { emit_html_index($_[0], $ctx) }; } +sub new_html { + my ($ctx) = @_; + my @paths; + my (undef, $last) = each_recent_blob($ctx, sub { + my ($path, $commit, $ts, $u, $subj) = @_; + $ctx->{first} ||= $commit; + push @paths, $path; + }); + if (!@paths) { + return [404, ['Content-Type', 'text/plain'], + ["No messages, yet\n"] ]; + } + $ctx->{-html_tip} = '
';
+	$ctx->{-upfx} = '';
+	my $res = PublicInbox::WwwStream->new($ctx, sub {
+		while (my $path = shift @paths) {
+			my $m = do_cat_mail($ctx->{-inbox}, $path) or next;
+			my $more = scalar @paths;
+			my $s = PublicInbox::View::index_entry($m, $ctx, $more);
+			$s .= '
' unless $more; + return $s; + } + undef; + }); + [ 200, ['Content-Type', 'text/html; charset=UTF-8'], $res ] +} + # private subs sub title_tag {