From 2c1ae002c82e0cd3b6837199fa0e58e9fb4647cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Fri, 7 May 2021 00:59:10 +0200 Subject: Encode entities in PerlMonks titles and author names --- run/perlmonks | 8 +++++--- run/rss | 2 +- src/index.html | 1 + 3 files changed, 7 insertions(+), 4 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 <
Date: $d
diff --git a/run/rss b/run/rss index 80256e4..1fdaf09 100755 --- a/run/rss +++ b/run/rss @@ -22,7 +22,7 @@ my @entries = sort { $b->issued <=> $a->issued } $feed->entries; # Print summary of five latest entries for my $entry (@entries[0..4]) { - my $d = encode_entities $entry->issued->strftime('%a, %e %B %Y %H:%M:%S UTC'); + my $d = $entry->issued->strftime('%a, %e %B %Y %H:%M:%S UTC'); my $f = encode_entities decode('utf8', $entry->author); my $s = encode_entities decode('utf8', $entry->title); my $l = encode_entities $entry->link; diff --git a/src/index.html b/src/index.html index 2f1aa9d..d01f3fe 100644 --- a/src/index.html +++ b/src/index.html @@ -126,6 +126,7 @@ Perl forums as of Created and maintained by John Ankarström, a.k.a. johnaj.
Last updated on .eval print scalar localtime, ".\n"; +
View source -- cgit v1.2.3