browser: strip link urls from cell titles
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 27 Apr 2017 00:38:40 +0000 (02:38 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 16:51:18 +0000 (18:51 +0200)
browser.plp

index 85ed156..de245b8 100644 (file)
@@ -311,6 +311,15 @@ sub formatnotes {
        return @html;
 }
 
+sub notestotitle {
+       my @notes = @_;
+       for (@notes) {
+               EscapeHTML($_);
+               s{ \[ ([^]]*) \] \( [^)]* \) }{$1}gx;  # strip link urls
+       }
+       return @notes;
+}
+
 sub saytitlecol {
        my ($id) = @_;
        my $row = $caniuse->{data}->{$id};
@@ -396,7 +405,7 @@ sub saybrowsercols {
                                map { split / /, $_ }
                                $prev
                        ));
-                       $title .= "\n".EscapeHTML($_) for @notes;
+                       $title .= "\n$_" for notestotitle(@notes);
 
                        printf('<td class="%s" colspan="%d" title="%s">%s',
                                join(' ',