about summary refs log tree commit homepage
path: root/lib/PublicInbox/WWW.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-08-18 04:44:07 +0000
committerEric Wong <e@80x24.org>2016-08-18 09:31:55 +0000
commitadecbd43d2eed046fe6e88a459d03567461fd84b (patch)
tree7900b8ee9e908daa6fa8ddbef3c7ad846ecd8c8b /lib/PublicInbox/WWW.pm
parentdfe55f5ee5bd6e3a12d933a6570eb94f294d1c54 (diff)
downloadpublic-inbox-adecbd43d2eed046fe6e88a459d03567461fd84b.tar.gz
Begin documenting some basic help functionality.
I may tweak the anchor names of the various HTML endpoints
to be more consistent with each other (old ones will be
supported for a short while), so I'm not documenting
those, for now.

This may become part of a builtin key-value store for
basic texts, but this probably shouldn't become a wiki
engine, either.
Diffstat (limited to 'lib/PublicInbox/WWW.pm')
-rw-r--r--lib/PublicInbox/WWW.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 6f6a0033..4d599fc9 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -96,6 +96,8 @@ sub call {
 
         } elsif ($path_info =~ m!$INBOX_RE/$MID_RE/f/?\z!o) {
                 r301($ctx, $1, $2);
+        } elsif ($path_info =~ m!$INBOX_RE/_/text(?:/(.*))?\z!o) {
+                get_text($ctx, $1, $2);
 
         # convenience redirects order matters
         } elsif ($path_info =~ m!$INBOX_RE/([^/]{2,})\z!o) {
@@ -238,6 +240,18 @@ sub get_thread {
         PublicInbox::View::thread_html($ctx);
 }
 
+# /$INBOX/_/text/$KEY/
+# /$INBOX/_/text/$KEY/raw
+# KEY may contain slashes
+sub get_text {
+        my ($ctx, $inbox, $key) = @_;
+        my $r404 = invalid_inbox($ctx, $inbox);
+        return $r404 if $r404;
+
+        require PublicInbox::WwwText;
+        PublicInbox::WwwText::get_text($ctx, $key);
+}
+
 sub ctx_get {
         my ($ctx, $key) = @_;
         my $val = $ctx->{$key};