about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-10-04 00:13:47 +0000
committerEric Wong <e@80x24.org>2015-10-04 00:14:25 +0000
commit9d39eb9bd16f3f2d81785b14e94f10e105f497d7 (patch)
treeb950bebee16aaeef1651983690050053cdf2ab4b /lib
parent9bc8cf2e9866393470cdb76a2af39d63f4246204 (diff)
downloadpublic-inbox-9d39eb9bd16f3f2d81785b14e94f10e105f497d7.tar.gz
Having per-thread Atom feeds and downloadable mboxen is powerful
and should be more easily visible/accessible to casual readers.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index c9be7700..beb99895 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -12,6 +12,7 @@ use PublicInbox::Hval;
 use PublicInbox::MID qw/mid_clean id_compress mid2path/;
 use Digest::SHA qw/sha1_hex/;
 my $SALT = rand;
+my $MBOX_TITLE = 'title="download thread as gzipped mbox"';
 require POSIX;
 
 # TODO: make these constants tunable
@@ -198,7 +199,8 @@ sub emit_thread_html {
         my $next = "<a\nid=\"s$final_anchor\">";
         $next .= $final_anchor == 1 ? 'only message in' : 'end of';
         $next .= " thread</a>, back to <a\nhref=\"../../\">index</a>";
-        $next .= "\ndownload thread: <a\nhref=\"../t.mbox.gz\">mbox.gz</a>";
+        $next .= "\ndownload thread: ";
+        $next .= "<a\n$MBOX_TITLE\nhref=\"../t.mbox.gz\">mbox.gz</a>";
         $next .= " / follow: <a\nhref=\"../t.atom\">Atom feed</a>";
         $cb->write("<hr />" . PRE_WRAP . $next . "\n\n". $foot .
                    "</pre></body></html>");
@@ -862,17 +864,21 @@ sub dump_topics {
                 $ts = POSIX::strftime('%Y-%m-%d %H:%M', gmtime($ts));
                 if ($n == 1) {
                         $attr = "created by $u @ $ts UTC";
-                        $n = "\n";
+                        $n = "";
                 } else {
                         # $n isn't the total number of posts on the topic,
                         # just the number of posts in the current results
                         # window, so leave it unlabeled
                         $attr = "updated by $u @ $ts UTC";
-                        $n = " ($n)\n";
+                        $n = " ($n)";
                 }
                 if ($level == 0 || $attr ne $prev_attr) {
+                        my $mbox = qq(<a\n$MBOX_TITLE\n) .
+                                   qq(href="$mid/t.mbox.gz">mbox.gz</a>);
+                        my $atom = qq(<a\nhref="$mid/t.atom">Atom</a>);
                         $pfx .= INDENT if $level > 0;
                         $dst .= "$pfx- ". $attr . $n;
+                        $dst .= " - $mbox / $atom\n";
                         $prev_attr = $attr;
                 }
         }