sample: reference chapter titles by first word
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 26 Oct 2023 22:11:04 +0000 (00:11 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 26 Oct 2023 23:30:04 +0000 (01:30 +0200)
Support client targeting within the document.

sample.plp

index f824e1458e39e4f24356267692f28ac8900090ff..be68403b48ce1e3bbfdccc96488d60434c3f1bf5 100644 (file)
@@ -22,7 +22,7 @@ print $intro;
 
 while (my $p = readline $source) {
        EscapeHTML($p);
-       $p =~ s{ \A (\N+:) \n\Z }{<h2>$1</h2>}x;
+       $p =~ s{ \A ((\pL+) \N*:) \n\Z }{<h2 id="\L$2\E">$1</h2>}x;
        print $p;
 }