diff options
author | Eric Wong <e@80x24.org> | 2014-08-28 02:14:47 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2014-08-28 02:47:11 +0000 |
commit | c5d457c20c4ac43b877221b23ad6b2dbdf3b6d75 (patch) | |
tree | 4102060aeba1d2260643ef16194ddf50df4b36a8 /lib | |
parent | b01b542b95d10ce9d782ceb27412b9eac873f1d8 (diff) | |
download | public-inbox-c5d457c20c4ac43b877221b23ad6b2dbdf3b6d75.tar.gz |
This will make it easier to bookmark an index page with threading context.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Feed.pm | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/PublicInbox/Feed.pm b/lib/PublicInbox/Feed.pm index cf64517b..1eaba6c2 100644 --- a/lib/PublicInbox/Feed.pm +++ b/lib/PublicInbox/Feed.pm @@ -59,7 +59,7 @@ sub generate_html_index { my @messages; my $git = PublicInbox::GitCatFile->new($args->{git_dir}); - my $last = each_recent_blob($args, sub { + my ($first, $last) = each_recent_blob($args, sub { my $mime = do_cat_mail($git, $_[0]) or return 0; my $t = eval { str2time($mime->header('Date')) }; @@ -89,7 +89,7 @@ sub generate_html_index { Email::Address->purge_cache; - my $footer = nav_footer($args->{cgi}, $last, $feed_opts); + 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; @@ -99,21 +99,22 @@ sub generate_html_index { # private subs sub nav_footer { - my ($cgi, $last, $feed_opts) = @_; + my ($cgi, $first, $last, $feed_opts) = @_; $cgi or return ''; my $old_r = $cgi->param('r'); my $head = ' '; my $next = ' '; if ($last) { - $next = qq!<a href="?r=$last">next</a>!; + $next = qq!<a\nhref="?r=$last">next</a>!; } if ($old_r) { $head = $cgi->path_info; - $head = qq!<a href="$head">head</a>!; + $head = qq!<a\nhref="$head">head</a>!; } - my $atom = "<a href=\"$feed_opts->{atomurl}\">atom</a>"; - "$next $head $atom"; + my $atom = "<a\nhref=\"$feed_opts->{atomurl}\">atom</a>"; + my $permalink = "<a\nhref=\"?r=$first\">permalink</a>"; + "$next $head $atom $permalink"; } sub each_recent_blob { @@ -174,7 +175,7 @@ sub each_recent_blob { close $log; # we may EPIPE here # for pagination - $commits[-1]; + ($commits[0], $commits[-1]); } # private functions below |