From ccba560ee34a4fd7531e76b578b53e449dcaf5ff Mon Sep 17 00:00:00 2001 From: Dave Morriss Date: Thu, 23 May 2024 20:14:42 +0100 Subject: [PATCH] Setting up static RSS feeds site-generator: Changed the routine used to generate entities in 'HTML::Entities'; see filter function 'xml_entity' site.cfg: Added root variable 'http_baseurl' which defines the base URL using 'http' templates/rss.tpl.xml: RSS template defining the channel and inserting the 'item' definitions; adjusted to be in step with the PHP version. templates/shared-item.tpl.xml: RSS template used for each 'item' in an RSS feed; contains a call to 'HTML::Strip' which turns off the addition of spaces when removing tags; adjusted to be in step with the PHP version. templates/shared-utils.tpl.html: Macro collection used by other templates; addition of temporay macro 'display_explicit_feed_2' which generates 'Yes/No' strings to be in step with the PHP version. --- site-generator | 25 +++++++++++++++---------- site.cfg | 1 + templates/rss.tpl.xml | 12 ++++++------ templates/shared-item.tpl.xml | 15 ++++++++------- templates/shared-utils.tpl.html | 4 ++++ 5 files changed, 34 insertions(+), 23 deletions(-) diff --git a/site-generator b/site-generator index dfdf1f8..80fce08 100755 --- a/site-generator +++ b/site-generator @@ -67,18 +67,21 @@ Perl Template Toolkit. - GRANT EXECUTE ON `hpr_hpr`.* TO 'hpr-generator'@'localhost'; Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.) - * GetOpt - * Pod::Usage * Config::Std - * Template - * Template::Plugin::File - * Template::Plugin::DBI - * Template::Plugin::HTML::Strip - * DBI - * Tie::DBI * DBD::SQLite or DBD:mysql + * DBI + * Data::Dumper * Date::Calc + * GetOpt::Long + * HTML::Entities + * Pod::Usage + * Template + * Template::Plugin::DBI + * Template::Plugin::Date + * Template::Plugin::File + * Template::Plugin::HTML::Strip * Text::CSV_XS + * Tie::DBI =head1 AUTHOR @@ -115,7 +118,8 @@ use Getopt::Long qw(:config auto_help); use Pod::Usage; use Config::Std; use Text::CSV_XS; -use HTML::Entities qw(encode_entities_numeric); +#use HTML::Entities qw(encode_entities_numeric); +use HTML::Entities qw(encode_entities); use Date::Calc; use DBI; use DBD::SQLite; @@ -425,7 +429,8 @@ sub parse_csv { sub xml_entity { my ($text) = @_; - encode_entities_numeric( $text ); +# encode_entities_numeric( $text ); + encode_entities( $text ); return $text; } diff --git a/site.cfg b/site.cfg index 0c7aea7..4a4e280 100644 --- a/site.cfg +++ b/site.cfg @@ -29,6 +29,7 @@ content: page.tpl.html #baseurl: OPTIONAL [i.e. file://] #baseurl: file:///home/roan/Development/hpr/website/hpr_generator/public_html/ baseurl: https://hackerpublicradio.org/ +http_baseurl: http://hackerpublicradio.org/ hub_baseurl: https://hub.hackerpublicradio.org/ media_baseurl: https://archive.org/download/hpr$eps_id/ generator_name: The HPR Robot diff --git a/templates/rss.tpl.xml b/templates/rss.tpl.xml index d13d3d1..f08df3b 100644 --- a/templates/rss.tpl.xml +++ b/templates/rss.tpl.xml @@ -2,8 +2,8 @@ Hacker Public Radio @@ -17,7 +17,7 @@ - + yes Hacker Public Radio Community Radio, Tech Interviews, Linux, Open, Hobby, Software Freedom @@ -30,7 +30,7 @@ admin@hackerpublicradio.org (HPR Volunteer) site-generator - https://www.rssboard.org/rss-specification + http://www.rssboard.org/rss-specification 43200 Saturday @@ -47,9 +47,9 @@ HPR Volunteer Hacker Public Radio is a podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that is of interest to hackers and hobbyists. admin@hackerpublicradio.org - + - + diff --git a/templates/shared-item.tpl.xml b/templates/shared-item.tpl.xml index 309baf8..71dbdeb 100644 --- a/templates/shared-item.tpl.xml +++ b/templates/shared-item.tpl.xml @@ -1,24 +1,25 @@ - + - - HPR<!--% zero_pad_left(episode.id) %-->: <!--% episode.title %--> + + HPR<!--% zero_pad_left(episode.id) %-->: <!--% episode.title | html_strip | xml_entity %--> () () () - + eps/hpr/index.html ]]> ]]> - - eps/hpr. - + + eps/hpr. + + diff --git a/templates/shared-utils.tpl.html b/templates/shared-utils.tpl.html index b2572ae..6416911 100644 --- a/templates/shared-utils.tpl.html +++ b/templates/shared-utils.tpl.html @@ -35,6 +35,10 @@ + + + +