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: Thu, 17 Jan 2019 11:22:01 -0500 (EST)

CVSROOT:        /web/www
Module name:    www
Changes by:     Ineiev <ineiev> 19/01/17 11:22:00

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

Log message:
        Don't output incomplete HTML entities.

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

Patches:
Index: planetrss.pl
===================================================================
RCS file: /web/www/www/server/source/planetrss/planetrss.pl,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- planetrss.pl        27 Sep 2018 07:08:08 -0000      1.29
+++ planetrss.pl        17 Jan 2019 16:22:00 -0000      1.30
@@ -1,7 +1,7 @@
 # PlanetRSS: fetch feeds from planetgnu.org and output them as HTML.
 #
 # Copyright © 2011 Shailesh Ghadge
-# Copyright © 2013, 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
+# Copyright © 2013, 2014, 2015, 2017, 2018, 2019 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 +29,7 @@
 # Provides argument handling.
 use Getopt::Long;
 
-my $Version = "1.18";
+my $Version = "1.19";
 my $default_lines = 3;
 my $default_length = 200;
 # We couldn't make this script extract passages that would be suitable
@@ -143,7 +143,7 @@
   {
     print "PlanetRSS ".$Version."
 Copyright (C) 2011 Shailesh Ghadge
-Copyright (C) 2013, 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
+Copyright (C) 2013, 2014, 2015, 2017 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
@@ -236,9 +236,9 @@
     $desc =~ s/(&amp;)amp;/$1/gi;
     $desc =~ s/\s\s+/ /g;
 
-    # Empty description: no "more", no ":".
-    $tail = "" unless length ($desc);
+    # Empty description: no ":", no "...".
     $head = "" unless length ($desc);
+    $tail = "" unless length ($desc);
 
     $d0 = $desc;
 
@@ -269,16 +269,20 @@
         $desc = substr($desc, 0, ($FeedLength-(10+length($title))));
       }
 
-    # If we print whole description, there is no "more".
+    # If we print whole description, no "..." is needed.
     $tail = "" unless $d0 ne $desc;
 
-    # Kill trailing spaces and possible start of tag.
+    # Kill trailing spaces.
     $desc =~ s/[<\s]*$//;
+    # Kill possible start of tag.
+    $desc =~ s/<[^>]*$//;
 
     if ($tail ne "")
       {
         # Kill ending commas.
         $desc =~ s/[.,:;]*$//;
+        # Kill incomplete HTML entity.
+        $desc =~ s/&[^;]*$//;
         # Produce "!.." and "?.." rather than "!..." and "?...".
         $tail =~ s/.// if $desc =~ /[!?]$/;
       }



reply via email to

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