sample: serve text file as proper sample.txt page
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 7 Nov 2023 19:52:46 +0000 (20:52 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 8 Nov 2023 00:00:54 +0000 (01:00 +0100)
Link to a stable endpoint, with appropriate charset header.

.htaccess
sample.plp
sample.txt [new symlink]

index 61d5f361294680c77f63a66552a6f35cee1c4d2e..22602d7b3ffa0aa7a05fd42ce2fe6a0d5b1b661d 100644 (file)
--- a/.htaccess
+++ b/.htaccess
@@ -1,6 +1,7 @@
 Options        -MultiViews -Indexes
 DirectoryIndex index.plp
 DirectorySlash Off
+AddCharset     utf-8 .txt
 
 RewriteEngine  on
 RewriteBase    /
index 79df0335bd95306f384183de836a347fd8aecc73..12460ec14e7db44624436747056a16bb6b4bc697 100644 (file)
@@ -1,6 +1,6 @@
 <(common.inc.plp)><:
 
-my $textinc = 'data/unicode-sampler/unicode.txt';
+my $textinc = 'sample.txt';
 my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's');
 my $preview = "$proto$ENV{HTTP_HOST}/sample.png";
 
@@ -19,8 +19,12 @@ local $/ = "\n\n";
 my $top = readline $source;
 my ($title, $hr, $intro) = split /\n(\pP)\1+\n/, $top, 2;
 say "<h1>$title</h1>";
-printf '<p>HTML display of <a href="%s">plain text</a>', $textinc;
-say ' intended for monospaced (terminal) output.</p>';
+say <<".";
+<p>HTML display of <a href="/$textinc">plain text</a>
+intended for monospaced (terminal) output.
+Compare an expected rendering of the <a href="/sample.png">overview</a>.
+</p>
+.
 
 say '<pre>';
 print $intro;
diff --git a/sample.txt b/sample.txt
new file mode 120000 (symlink)
index 0000000..9ce7fc7
--- /dev/null
@@ -0,0 +1 @@
+data/unicode-sampler/unicode.txt
\ No newline at end of file