From: Mischa POSLAWSKY Date: Wed, 17 May 2017 09:48:43 +0000 (+0200) Subject: sample: format section titles as html headers X-Git-Tag: v1.11~76 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/5ee97692d42eea5defce6d1ea12dc84e9578f608 sample: format section titles as html headers --- diff --git a/sample.plp b/sample.plp index 7f8b636..15323a3 100644 --- a/sample.plp +++ b/sample.plp @@ -8,13 +8,19 @@ Html({ open my $source, '<', 'data/unicode-sampler/unicode.txt' or die "Could not open text: $!\n"; +local $/ = "\n\n"; -my $title = readline $source; -my $hr = readline $source; +my $top = readline $source; +my ($title, $hr, $intro) = split /\n(\H)$1+\n/, $top, 2; say "

$title

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

$1

}x; + print $p; } + say "
\n";