Title and description contain special characters literally.
Other fields are usually to be inserted as HTML, but are not always valid
(stand-alone chars, invisible linebreaks) so apply some smart escaping.
sprintf("try { %s; return false } catch(err) { return true }",
"document.getElementById('$id').classList.toggle('target')",
),
sprintf("try { %s; return false } catch(err) { return true }",
"document.getElementById('$id').classList.toggle('target')",
),
);
} $row->{title};
print '<div class=aside>';
s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
);
} $row->{title};
print '<div class=aside>';
s/\.?$/./, print "<p>$_</p>" for map { ref $_ ? @$_ : $_ || () }
- $row->{description}, $row->{notes};
- printf 'Resources: %s.', join(', ',
- map { qq(<a href="$_->{url}">$_->{title}</a>) } @$_
- ) for grep { @$_ } $row->{links} // ();
+ Entity($row->{description}), formathtml($row->{notes}); # sic
+ printf 'Resources: %s.', join(', ', map {
+ sprintf '<a href="%s">%s</a>', EscapeHTML($_->{url}), $_->{title}
+ } @$_) for grep { @$_ } $row->{links} // ();
print '<tfoot>', $header;
print '</table>';
print '<tfoot>', $header;
print '</table>';
+sub formathtml {
+ my $ref = defined wantarray ? [@_] : \@_;
+ for (@$ref) {
+ s/& (?!\w)/&/gx;
+ s/< \s/</gx;
+ s/\n\K\n/<br>/g;
+ }
+ return @$ref;
+}
+
sub paddedver {
# normalised version number comparable as string (cmp)
shift =~ /^(\d*)(.*)/;
sub paddedver {
# normalised version number comparable as string (cmp)
shift =~ /^(\d*)(.*)/;