<(common.inc.plp)><:
my $textinc = 'sample.txt';
my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's');
my $preview = "$proto$ENV{HTTP_HOST}/sample.png";
Html({
title => "unicode sampler",
version => '2.1',
stylesheet => [qw'light dark mono red'],
data => [$textinc],
raw => qq(<meta property="og:image" content="$preview" />),
});
open my $source, '<', $textinc
or Abort("Could not open text at $textinc", 501, $!);
local $/ = "\n\n";
my $top = readline $source;
my ($title, $hr, $intro) = split /\n(\pP)\1+\n/, $top, 2;
say "<h1>$title</h1>";
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;
while (my $p = readline $source) {
EscapeHTML($p);
$p =~ s{ \A ((\pL+) \N*:) \n }{<h2 id="\L$2\E">$1</h2>}x;
if ($2 eq 'Unicode') {
$p =~ s/^(?= )/\x{202d}/gm;
}
$p =~ s{(?<=^ )([\p{Latin} ]+:)}{<em>$1</em>}gm;
print $p;
}
say "</pre>\n";