From: Emil Williams Date: Mon, 4 Aug 2025 15:34:58 +0000 (+0000) Subject: rss X-Git-Url: https://git.xolatile.top/?a=commitdiff_plain;h=4f246090cafccb1519c4582de6989fe64cd33bef;p=emil-xolatile.top.git rss --- diff --git a/bloog/bloog.pl b/bloog/bloog.pl index aedae3f..98909c1 100755 --- a/bloog/bloog.pl +++ b/bloog/bloog.pl @@ -1,6 +1,6 @@ #!/bin/perl -# feed.xml generator -# remember to put the last chronologically at the end of the ARGV list +# everything generator +# remember to put the last one chronologically at the end of the ARGV list use Template; use Time::Piece; use POSIX qw(strftime); @@ -16,10 +16,9 @@ my $last_time = ''; my $fh; foreach $argnum (0 .. $#ARGV) { - my $buffer; open($fh, '<', $ARGV[$argnum]) or die $!; # general data - chomp(my $date = <$fh>); + chomp(my $date = <$fh>); chomp(my $author = <$fh>); chomp(my $rss_title = <$fh>); chomp(my $html_title = <$fh>); @@ -34,10 +33,12 @@ foreach $argnum (0 .. $#ARGV) { rss_title => $html_title, description => $description, }; + my $buffer = ''; # rss item $template->process('feed_item.xml', $data, \$buffer) || die $template->error(), "\n"; push(@rss_items, $buffer); + $buffer = ''; # index item $template->process('index_item.html', $data, \$buffer) || die $template->error(), "\n"; @@ -47,7 +48,7 @@ foreach $argnum (0 .. $#ARGV) { my @paragraphs = (); my $pre = 0; my $raw = 0; - while (my $line = ) { + while (my $line = <$fh>) { chomp(my $short = $line); if ($short eq '' && not $pre && not $raw) { unless (substr($buffer, 0, 1) eq '<' && raw) { @@ -78,7 +79,7 @@ foreach $argnum (0 .. $#ARGV) { push(@paragraphs, $buffer); } my $article; - $data->paragraphs = \@paragraphs; + $data{paragraphs} = \@paragraphs; $template->process('article.html', $data, \$article) || die $template->error(), "\n"; close $fh;