perl: reinclude feature attributes
[sheet.git] / perl.plp
1 <(common.inc.plp)><:
2
3 Html({
4         title => 'perl version cheat sheet',
5         version => '1.3',
6         keywords => [qw'
7                 perl version feature features comparison
8                 sheet cheat overview summary
9         '],
10         stylesheet => [qw'light dark red'],
11         data => ['perl.inc.pl'],
12 });
13
14 :>
15 <h1>Perl release summary</h1>
16
17 <p>The most significant features introduced for recent versions of the Perl
18 scripting language.
19 <:
20 my $info = do 'perl.inc.pl' or die $@ // $!;
21
22 say "Depending on desired compatibility you'll want to support a minimum of";
23 say join(' or ', map {
24         sprintf '<span title="on %s">v%vd</span>', $info->{$_}->{distrosum}, $_
25 } v5.8, v5.20), '.';
26 say '</p>';
27
28 for my $vernum (reverse sort keys %{$info}) {
29         my $verrow = $info->{$vernum};
30         defined $verrow->{unstable} and next unless exists $get{v};
31
32         say '<div class="section">';
33         say sprintf '<h2>%vd <small>%s</small></h2>', $vernum, $verrow->{release};
34         say '<dl>';
35         for (@{ $verrow->{new} }) {
36                 my ($topic, $desc, $attr) = @{$_};
37                 if ($attr) {
38                         my $title;
39                         if (defined $attr->{experimental}) {
40                                 $title = 'experimental';
41                         }
42                         if ($attr->{dropped}) {
43                                 next unless exists $get{v};
44                                 $title = sprintf 'removed in %vd', $attr->{dropped};
45                         }
46                         elsif ($attr->{stable}) {
47                                 $title .= sprintf ' until %vd', $attr->{stable};
48                         }
49                         if ($attr->{experimental}) {
50                                 $title = sprintf '<span title="experimental::%s">%s</span>',
51                                         $attr->{experimental}, $title;
52                         }
53                         if ($attr->{feature}) {
54                                 my $prefix = sprintf '<span title="%s">feature</span>',
55                                         $attr->{feature};
56                                 $title = join ', ', $prefix, $title // ();
57                         }
58                         $desc .= sprintf ' <em class="ex">(%s)</em>', $title;
59                 }
60                 say sprintf '<dt>%s<dd>%s', $topic, $desc || '<br/>';
61         }
62         say sprintf '<dt>Unicode</dt><dd>v%s', $_ for $verrow->{unicode} || ();
63         say '</dl>';
64         say "</div>\n";
65 }
66