aboutsummaryrefslogtreecommitdiff
path: root/run/perlmonks
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-05-07 00:59:10 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-05-07 00:59:10 +0200
commit2c1ae002c82e0cd3b6837199fa0e58e9fb4647cc (patch)
tree750a8a1da674ad9a53281d164a58dc72a5821f4a /run/perlmonks
parentdaebe74b0a08df5685aedee63480936d5d98fbc2 (diff)
downloadperlisdead-2c1ae002c82e0cd3b6837199fa0e58e9fb4647cc.tar.gz
Encode entities in PerlMonks titles and author names
Diffstat (limited to 'run/perlmonks')
-rwxr-xr-xrun/perlmonks8
1 files changed, 5 insertions, 3 deletions
diff --git a/run/perlmonks b/run/perlmonks
index 53e9583..d64c93d 100755
--- a/run/perlmonks
+++ b/run/perlmonks
@@ -3,6 +3,7 @@
use strict;
use warnings;
+use HTML::Entities;
use LWP::UserAgent ();
use Time::Piece;
use XML::LibXML;
@@ -28,10 +29,11 @@ my @nodes =
for (@nodes) {
my ($node, $time) = @$_;
my $d = $time->strftime('%a, %e %B %Y %H:%M:%S UTC');
- my $f = ($node->findnodes('./@authortitle'))[0]->to_literal;
- (my $s = $node->to_literal) =~ s/^\s+|\s+$//;
- next if $s eq $f; # Skip home nodes
+ my $f = encode_entities ($node->findnodes('./@authortitle'))[0]->to_literal;
+ (my $s = encode_entities $node->to_literal) =~ s/^\s+|\s+$//;
my $l = 'https://www.perlmonks.org/?node_id=' . ($node->findnodes('./@node_id'))[0]->to_literal;
+
+ next if $s eq $f; # Skip home nodes
print <<HTML;
<div class="entry">
<div class="date">Date: $d</div>