browser: assume notes are valid html
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 03:22:36 +0000 (04:22 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 21:40:44 +0000 (22:40 +0100)
Latest database-derived data no longer contains invalid entities,
just linebreaks not represented by html in #video.

browser.plp

index aaafa038cafb70129c858b60ab5f4f819ce43186..7c494e9403c406c59e6afd4100fbf85130bcfcda 100644 (file)
@@ -236,7 +236,8 @@ sub saytitlecol {
        } $row->{title};
        print '<div class=aside>';
        s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
-               Entity($row->{description}), formathtml($row->{notes});  # sic
+               Entity($row->{description}),
+               map { s/\s*\n/\n<br>/g; $_ } $row->{notes};
        printf 'Resources: %s.', join(', ', map {
                sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), $_->{title}
        } @$_) for grep { @$_ } $row->{links} // ();
@@ -310,16 +311,6 @@ for my $id (sort {
 say '</tbody>';
 say '</table>';
 
-sub formathtml {
-       my $ref = defined wantarray ? [@_] : \@_;
-       for (@$ref) {
-               s/& (?!\w)/&amp;/gx;
-               s/< \s/&lt;/gx;
-               s/\n\K\n/<br>/g;
-       }
-       return @$ref;
-}
-
 sub paddedver {
        # normalised version number comparable as string (cmp)
        shift =~ /(?:.*-|^)(\d*)(.*)/;