]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Feed.pm
wwwstream: improve documentation and variable naming
[public-inbox.git] / lib / PublicInbox / Feed.pm
index 65adf373a7400d42b63e1acd85f951db1d0b2298..25fec10a0ea3095f5b81bce84cd220f3deddfa26 100644 (file)
@@ -8,7 +8,6 @@ use warnings;
 use Email::MIME;
 use Date::Parse qw(strptime);
 use PublicInbox::Hval qw/ascii_html/;
-use PublicInbox::Git;
 use PublicInbox::View;
 use PublicInbox::MID qw/mid_clean mid2path/;
 use PublicInbox::Address;
@@ -60,12 +59,12 @@ sub new_html {
        }
        $ctx->{-html_tip} = '<pre>';
        $ctx->{-upfx} = '';
+       $ctx->{-hr} = 1;
        PublicInbox::WwwStream->response($ctx, 200, 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 .= '</pre>' unless $more;
                        return $s;
                }
                new_html_footer($ctx, $last);
@@ -138,7 +137,7 @@ sub emit_atom_thread {
        my $fh = $cb->([200, ['Content-Type' => 'application/atom+xml']]);
        my $ibx = $ctx->{-inbox};
        my $html_url = $ibx->base_url($ctx->{env});
-       $html_url .= PublicInbox::Hval->new_msgid($mid)->as_href;
+       $html_url .= PublicInbox::Hval->new_msgid($mid)->{href};
 
        $feed_opts->{url} = $html_url;
        $feed_opts->{emit_header} = 1;
@@ -150,27 +149,6 @@ sub emit_atom_thread {
        end_feed($fh);
 }
 
-sub _html_index_top {
-       my ($feed_opts, $srch) = @_;
-
-       my $title = ascii_html($feed_opts->{description} || '');
-       my $top = "<b>$title</b> (<a\nhref=\"new.atom\">Atom feed</a>)";
-       if ($srch) {
-               $top = qq{<form\naction=""><pre>$top} .
-                         qq{ <input\nname=q\ntype=text />} .
-                         qq{<input\ntype=submit\nvalue=search />} .
-                         q{</pre></form><pre>}
-       } else {
-               $top = '<pre>' . $top . "\n";
-       }
-
-       "<html><head><title>$title</title>" .
-               "<link\nrel=alternate\ntitle=\"Atom feed\"\n".
-               "href=\"new.atom\"\ntype=\"application/atom+xml\"/>" .
-               PublicInbox::Hval::STYLE .
-               "</head><body>$top";
-}
-
 sub new_html_footer {
        my ($ctx, $last) = @_;
        my $qp = delete $ctx->{qp} or return;
@@ -253,7 +231,6 @@ sub each_recent_blob {
 # private functions below
 sub get_feedopts {
        my ($ctx) = @_;
-       my $pi_config = $ctx->{pi_config};
        my $inbox = $ctx->{inbox};
        my $obj = $ctx->{-inbox};
        my %rv = ( description => $obj->description );
@@ -289,10 +266,9 @@ sub feed_entry {
        my $midurl = $feed_opts->{midurl};
 
        my $header_obj = $mime->header_obj;
-       my $mid = $header_obj->header_raw('Message-ID');
-       defined $mid or return;
+       my $mid = mid_clean($header_obj->header_raw('Message-ID'));
        $mid = PublicInbox::Hval->new_msgid($mid);
-       my $href = $midurl . $mid->as_href . '/';
+       my $href = $midurl . $mid->{href}. '/';
 
        my $date = $header_obj->header('Date');
        my $updated = feed_updated($date);