diff --git a/Build.PL b/Build.PL index 8f712c8..baa1e99 100644 --- a/Build.PL +++ b/Build.PL @@ -69,7 +69,7 @@ my $build = $class->new( 'Plack::App::File' => 0, 'Plack::Middleware::JSONP' => 0, 'Plack::Builder' => 0, - 'Text::Markup' => '0.15', + 'Text::Markup' => '0.33', 'URI::Template' => '0.16', 'XML::LibXML' => '1.70', }, diff --git a/Changes b/Changes index 356df77..eaceb2e 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,10 @@ Revision history for Perl extension PGXN::API - Fixed a bug where a user's JSON file was not updated for a testing release when there were no previous stable releases, or for an unstable release when there wer not previous testing releases. + - The indexer now recognizes plain text files ending in `.txt` or `.text` + as documentation files to be indexed. They're parsed by the default + Text::Markup::None parser, which wraps their contents in a `
`
+        block (#13).
 
 0.20.0  2024-02-09T17:36:10Z
       - Removed the `Capfile` and `eg` directory. Examples for managing PGXN
diff --git a/lib/PGXN/API/Indexer.pm b/lib/PGXN/API/Indexer.pm
index 471bdbe..ea9d47b 100644
--- a/lib/PGXN/API/Indexer.pm
+++ b/lib/PGXN/API/Indexer.pm
@@ -10,6 +10,7 @@ use File::Copy::Recursive qw(fcopy dircopy);
 use File::Basename;
 use Text::Markup;
 use Text::Markup::CommonMark;
+use Text::Markup::None qr/te?xt/;
 use XML::LibXML;
 use List::Util qw(first);
 use List::MoreUtils qw(uniq);
diff --git a/lib/PGXN/API/Router.pm b/lib/PGXN/API/Router.pm
index fa71461..90b8558 100644
--- a/lib/PGXN/API/Router.pm
+++ b/lib/PGXN/API/Router.pm
@@ -29,7 +29,6 @@ sub app {
     # Identify distribution files as zip files.
     my ($zip_ext) = PGXN::API->instance->uri_templates->{download} =~ /([.][^.]+)$/;
     $Plack::MIME::MIME_TYPES->{$zip_ext} = $Plack::MIME::MIME_TYPES->{'.zip'};
-    my %bys = map { $_ => undef } qw(dist extension user tag);
 
     builder {
         enable 'ErrorDocument', 500, '/error', subrequest => 1;
diff --git a/t/indexer.t b/t/indexer.t
index f9288c9..a9133f4 100644
--- a/t/indexer.t
+++ b/t/indexer.t
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use Test::More tests => 266;
+use Test::More tests => 268;
 # use Test::More 'no_plan';
 use File::Copy::Recursive qw(dircopy fcopy);
 use File::Path qw(remove_tree);
@@ -65,6 +65,12 @@ can_ok $CLASS => qw(
     _clean_html_body
 );
 
+# Make sure Text::Markup recognizes the "none" parser for text files.
+is +Text::Markup->guess_format("foo.text"), "none",
+    'Text::Markup should parse .text files with the "none" parser';
+is +Text::Markup->guess_format("foo.txt"), "none",
+    'Text::Markup should parse .txt files with the "none" parser';
+
 my $api = PGXN::API->instance;
 my $doc_root = catdir 't', 'test_indexer_root';
 $api->doc_root($doc_root);