index: release v1.18 with only altgr index linked
[sheet.git] / sample.plp
1 <(common.inc.plp)><:
2
3 my $textinc = 'sample.txt';
4
5 Html({
6         title => "unicode sampler",
7         version => '2.1',
8         stylesheet => [qw'light dark mono red'],
9         data => [$textinc],
10         image => 'sample.png',
11 });
12
13 open my $source, '<', $textinc
14         or Abort("Could not open text at $textinc", 501, $!);
15 local $/ = "\n\n";
16
17 my $top = readline $source;
18 my ($title, $hr, $intro) = split /\n(\pP)\1+\n/, $top, 2;
19 say "<h1>$title</h1>";
20 say <<".";
21 <p>HTML display of <a href="/$textinc">plain text</a>
22 intended for monospaced (terminal) output.
23 Compare an expected rendering of the <a href="/sample.png">overview</a>.
24 </p>
25 .
26
27 say '<pre>';
28 print $intro;
29
30 while (my $p = readline $source) {
31         EscapeHTML($p);
32         $p =~ s{ \A ((\pL+) \N*:) \n }{<h2 id="\L$2\E">$1</h2>}x;
33         if ($2 eq 'Unicode') {
34                 # table without proper direction control
35                 $p =~ s/^(?= )/\x{202d}/gm; # ltr override every line
36         }
37         $p =~ s{(?<=^  )([\p{Latin} ]+:)}{<em>$1</em>}gm;
38         print $p;
39 }
40
41 say "</pre>\n";