about summary refs log tree commit homepage
path: root/lib/PublicInbox/Feed.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2014-09-15 04:16:45 +0000
committerEric Wong <e@80x24.org>2014-09-15 04:16:45 +0000
commitd8458d7f5f410799801c541f325e14fd0be5c989 (patch)
tree7abaa358fcb7a6692e1d4360d5ad963cf5c4d256 /lib/PublicInbox/Feed.pm
parent75980e10b89ccd6df8e583483cba40f93338fc5c (diff)
downloadpublic-inbox-d8458d7f5f410799801c541f325e14fd0be5c989.tar.gz
This helps readers jump around more quickly when there are
large messages.
Diffstat (limited to 'lib/PublicInbox/Feed.pm')
-rw-r--r--lib/PublicInbox/Feed.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm
index 1fa38bf1..791d198a 100644
--- a/lib/PublicInbox/Feed.pm
+++ b/lib/PublicInbox/Feed.pm
@@ -87,30 +87,33 @@ sub generate_html_index {
         });
 
         # except we sort top-level messages reverse chronologically
-        my $state = [ time, {}, $first ];
+        my $state = [ time, {}, $first, 0 ];
         for (sort { (eval { $b->message->header('X-PI-Date') } || 0) <=>
                     (eval { $a->message->header('X-PI-Date') } || 0)
                   } $th->rootset) {
                 dump_msg($_, 0, \$html, $state);
         }
-        $state = undef;
         Email::Address->purge_cache;
 
-        my $footer = nav_footer($args->{cgi}, $first, $last, $feed_opts);
-        my $list_footer = $args->{footer};
-        $footer .= "\n" . $list_footer if ($footer && $list_footer);
-        $footer = "<hr />" . PRE_WRAP . "$footer</pre>" if $footer;
+        my $footer = nav_footer($args->{cgi}, $last, $feed_opts, $state);
+        if ($footer) {
+                my $list_footer = $args->{footer};
+                $footer .= "\n" . $list_footer if $list_footer;
+                $footer = "<hr />" . PRE_WRAP . "$footer</pre>";
+        }
         $html . "</pre>$footer</html>";
 }
 
 # private subs
 
 sub nav_footer {
-        my ($cgi, $first, $last, $feed_opts) = @_;
+        my ($cgi, $last, $feed_opts, $state) = @_;
         $cgi or return '';
         my $old_r = $cgi->param('r');
         my $head = '    ';
         my $next = '    ';
+        my $first = $state->[2];
+        my $anchor = $state->[3];
 
         if ($last) {
                 $next = qq!<a\nhref="?r=$last">next</a>!;
@@ -121,7 +124,7 @@ sub nav_footer {
         }
         my $atom = "<a\nhref=\"$feed_opts->{atomurl}\">atom</a>";
         my $permalink = "<a\nhref=\"?r=$first\">permalink</a>";
-        "$next $head $atom $permalink";
+        "<a\nname=\"s$anchor\">page:</a> $next $head $atom $permalink";
 }
 
 sub each_recent_blob {