X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/2aa0942b62a6812b687b293f40775d004be6cbe1..7178c19ec55db35dc1d073aef9a20138b15b19d7:/sample.plp diff --git a/sample.plp b/sample.plp index 33d06e9..12460ec 100644 --- a/sample.plp +++ b/sample.plp @@ -1,28 +1,42 @@ <(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"; Html({ title => "unicode sampler", - version => '2.0', + version => '2.1', stylesheet => [qw'light dark mono red'], data => [$textinc], + raw => qq(), }); open my $source, '<', $textinc - or die "Could not open text at $textinc: $!\n"; + or Abort("Could not open text at $textinc", 501, $!); local $/ = "\n\n"; my $top = readline $source; -my ($title, $hr, $intro) = split /\n(\H)$1+\n/, $top, 2; +my ($title, $hr, $intro) = split /\n(\pP)\1+\n/, $top, 2; say "

$title

"; +say <<"."; +

HTML display of plain text +intended for monospaced (terminal) output. +Compare an expected rendering of the overview. +

+. say '
';
 print $intro;
 
 while (my $p = readline $source) {
 	EscapeHTML($p);
-	$p =~ s{ \A (\N+:) \n\Z }{

$1

}x; + $p =~ s{ \A ((\pL+) \N*:) \n }{

$1

}x; + if ($2 eq 'Unicode') { + # table without proper direction control + $p =~ s/^(?= )/\x{202d}/gm; # ltr override every line + } + $p =~ s{(?<=^ )([\p{Latin} ]+:)}{$1}gm; print $p; }