www-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

www/server/source/planetrss planetrss.pl


From: Ineiev
Subject: www/server/source/planetrss planetrss.pl
Date: Tue, 19 May 2020 07:40:30 -0400 (EDT)

CVSROOT:        /web/www
Module name:    www
Changes by:     Ineiev <ineiev> 20/05/19 07:40:30

Modified files:
        server/source/planetrss: planetrss.pl 

Log message:
        strip more tags; support stripping tags with attributes

CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/server/source/planetrss/planetrss.pl?cvsroot=www&r1=1.30&r2=1.31

Patches:
Index: planetrss.pl
===================================================================
RCS file: /web/www/www/server/source/planetrss/planetrss.pl,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -b -r1.30 -r1.31
--- planetrss.pl        17 Jan 2019 16:22:00 -0000      1.30
+++ planetrss.pl        19 May 2020 11:40:29 -0000      1.31
@@ -1,7 +1,8 @@
 # PlanetRSS: fetch feeds from planetgnu.org and output them as HTML.
 #
 # Copyright © 2011 Shailesh Ghadge
-# Copyright © 2013, 2014, 2015, 2017, 2018, 2019 Free Software Foundation, 
Inc.
+# Copyright © 2013, 2014, 2015, 2017, 2018, 2019,
+#             2020 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -29,7 +30,7 @@
 # Provides argument handling.
 use Getopt::Long;
 
-my $Version = "1.19";
+my $Version = "1.20";
 my $default_lines = 3;
 my $default_length = 200;
 # We couldn't make this script extract passages that would be suitable
@@ -76,7 +77,7 @@
   my $tag = shift;
   my $repl = shift;
 
-  $str =~ s/&lt;$tag(.*?)&gt;/$repl/gi;
+  $str =~ s/&lt;$tag\b(.*?)&gt;/$repl/gi;
   $str =~ s/&lt;\/$tag&gt;//gi;
 
   return $str;
@@ -199,6 +200,9 @@
     # Sanitize description.
     $desc =~ s/&lt;br \/&gt;//gi; $desc =~ s/\s\s+/ /g;
     $desc = strip_tag ($desc, "span");
+    $desc = strip_tag ($desc, "figure");
+    $desc = strip_tag ($desc, "article");
+    $desc = strip_tag ($desc, "blockquote");
     $desc = strip_tag ($desc, "a") unless $a == 1;
     $desc = strip_tag ($desc, "b") unless $b == 1;
     $desc = strip_tag ($desc, "code") unless $code == 1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]