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: Mon, 7 May 2018 05:17:56 -0400 (EDT)

CVSROOT:        /web/www
Module name:    www
Changes by:     Ineiev <ineiev> 18/05/07 05:17:56

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

Log message:
        switch STDOUT to UTF-8; add option to change feed URL

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

Patches:
Index: planetrss.pl
===================================================================
RCS file: /web/www/www/server/source/planetrss/planetrss.pl,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- planetrss.pl        5 Oct 2017 06:30:05 -0000       1.27
+++ planetrss.pl        7 May 2018 09:17:55 -0000       1.28
@@ -1,7 +1,7 @@
 # PlanetRSS: fetch feeds from planetgnu.org and output them as HTML.
 #
 # Copyright © 2011 Shailesh Ghadge
-# Copyright © 2013, 2014, 2015, 2017 Free Software Foundation, Inc.
+# Copyright © 2013, 2014, 2015, 2017, 2018 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,12 +29,13 @@
 # Provides argument handling.
 use Getopt::Long;
 
-my $Version = "1.15";
+my $Version = "1.17";
 my $default_lines = 3;
 my $default_length = 200;
 # We couldn't make this script extract passages that would be suitable
 # for homepage from Remotecontrol feeds.
 my $default_exclude_pattern = '^GNU Remotecontrol: Newsletter';
+my $default_URL = "http://planet.gnu.org/rss20.xml";;
 my $head = "<!-- Autogenerated by planetrss.pl ".$Version." -->";
 
 $head .= '<!--#set var="a_close" value="</a>" -->'."\n";
@@ -45,9 +46,10 @@
 # Number of characters per feed.
 my $FeedLength = $default_length;
 
-# Regex for excluded titles
+# Regex for excluded titles.
 my $exclude_pattern = $default_exclude_pattern;
-
+# URL for feeds.
+my $url = $default_URL;
 # Other options.
 my $a = 0;
 my $b = 0;
@@ -80,7 +82,7 @@
   return $str;
 }
 
-my $feeds = get ("http://planet.gnu.org/rss20.xml";);
+binmode STDOUT, ":utf8";
 
 GetOptions ("a=i" => \$a, "b=i" => \$b, "code=i" => \$code, "div=i" => \$div,
             "em=i" => \$em, "h=i" => \$h, "hr=i" => \$hr, "i=i" => \$i,
@@ -88,7 +90,7 @@
             "strong=i" => \$strong, "table=i" => \$table,
             "textarea=i" => \$textarea, "tt=i" => \$tt, "ul=i" => \$ul,
             "FeedLines=i" => \$FeedLines, "FeedLength=i" => \$FeedLength,
-            "exclude=s" => \$exclude_pattern,
+            "exclude=s" => \$exclude_pattern, "url=s" => \$url,
             "help" => \$help, "version" => \$version);
 
 if ($help)
@@ -117,6 +119,7 @@
     -textarea=1     preserve textarea tags
     -tt=1           preserve tt tags
     -ul=1           preserve ul, ol, dl, li tags
+    -url=URL        override default URL
 
     -help           Display help and exit
     -version        Display version and exit
@@ -124,6 +127,7 @@
 Defaults:
     -FeedLines=".$default_lines." -FeedLength=".$default_length."
     -exclude='".$default_exclude_pattern."'
+    -url='".$default_URL."'
 
 Examples:
     perl planetrss.pl -FeedLines=7 -FeedLength=500
@@ -158,6 +162,8 @@
     exit;
   }
 
+my $feeds = get ($url);
+
 my $PGparser = new XML::RSS::Parser::Lite;
 my $gnun_split = "<span class=\"gnun-split\"></span>";
 



reply via email to

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