index: bump version to 1.6
[sheet.git] / browser.plp
index 85ee802e046a8efcd99992694e3541a2f2ab186c..8a5fba88bcc86b6e2585c238ec7f97d443073dac 100644 (file)
@@ -5,7 +5,7 @@ use List::Util qw(sum max first);
 
 Html({
        title => 'browser compatibility cheat sheet',
-       version => 'v1.1',
+       version => 'v1.2',
        description => [
                "Compatibility table of new web features (HTML5, CSS3, SVG, Javascript)",
                "comparing support and usage share for all popular browser versions.",
@@ -293,6 +293,18 @@ sub featurescore {
        return $rank;
 }
 
+sub formatnotes {
+       my @html = @_;
+       for (@html) {
+               s/\h* $//gmx;  # trailing whitespace
+               s/(?<= [^.\n]) $/./gmx;  # consistently end each line by a period
+               Entity($_);
+               s{  ` ([^`]*)  ` }{<code>$1</code>}gx;
+               s{ \[ ([^]]*) \] \( ([^)]*) \) }{<a href="$2">$1</a>}gx;
+       }
+       return @html;
+}
+
 sub saytitlecol {
        my ($id) = @_;
        my $row = $caniuse->{data}->{$id};
@@ -313,9 +325,8 @@ sub saytitlecol {
                );
        } $row->{title};
        print '<div class=aside>';
-       s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
-               Entity($row->{description}),
-               map { s/\s*\n/\n<br>/g; $_ } $row->{notes};
+       print "<p>$_</p>"
+               for formatnotes($row->{description}, $row->{notes} || ());
        printf 'Resources: %s.', join(', ', map {
                sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), $_->{title}
        } @$_) for grep { @$_ } $row->{links} // ();