commit 08d880d73df10b284844132139206ad021a23e8c
parent 0efcc7d21163aab72895f1856b36203033b79b3f
Author: lash <dev@holbrook.no>
Date: Sun, 15 Sep 2024 19:58:07 +0100
Fix empty description in rss, replace lf with html br
Diffstat:
4 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/Bluto.pm b/Bluto.pm
@@ -351,10 +351,10 @@ sub create_announce {
sub create_rss {
my $env = shift;
- my $out = shift;
+ my $out = Bluto::Announce::get_asciidoc(\%m_main, $env);
if (!defined $out) {
- $out = Bluto::Announce::get_asciidoc(\%m_main, $env);
+ return undef;
}
#return Bluto::RSS::to_string(\%m_main, $env, $out);
diff --git a/Bluto/Announce.pm b/Bluto/Announce.pm
@@ -2,6 +2,8 @@ package Bluto::Announce;
use Log::Term::Ansi qw/error info debug warn trace/;
+my $pos;
+
sub _adapt_headings {
my $f;
my $last = undef;
@@ -54,13 +56,18 @@ sub get_asciidoc {
}
} else {
debug("no template specified, using default");
- my $tpl = do { local $/; <Bluto::Announce::DATA> };
+ if (!defined $pos) {
+ $pos = tell(Bluto::Announce::DATA);
+ }
+ seek(Bluto::Announce::DATA, $pos, 0);
+ my $tpl = do { local $/; <Bluto::Announce::DATA>};
if (!$tt->process(\$tpl, $release, \$v)) {
error('error processing default template (sorry!!): '. $tt->error());
$v = undef;
}
}
+
$v = _adapt_headings($v);
return $v;
diff --git a/Bluto/RSS.pm b/Bluto/RSS.pm
@@ -26,6 +26,7 @@ sub process {
my $body = shift;
my $force = 1;
+ $body =~ s#\n#<br/>#mg;
my $rss_title = $release->{slug} . ' ' . $release->{version};
my $rss;
$rss = XML::RSS->new;
@@ -73,7 +74,7 @@ sub process {
}
}
- print "releasetime ". $release->{time} . "\n";
+ info("releasetime ". $release->{time} . "\n");
$rss->add_item (
title => $rss_title,
link => $release->{src}[0],
@@ -115,6 +116,7 @@ sub to_file {
return undef;
}
$rss->save(get_feed_filepath($release, $env));
+
return get_feed_filepath($release, $env);
}
diff --git a/Bluto/Tree.pm b/Bluto/Tree.pm
@@ -18,9 +18,9 @@ sub prepare {
my $release = shift;
my $env = shift;
- $_release_path = File::Spec->catfile($env->{out_dir}, $release->{slug}, 'src');
+ $_release_path = File::Spec->catfile($env->{out_dir}, 'src', $release->{slug});
make_path(release_path);
- $_announce_path = File::Spec->catfile($env->{out_dir}, $release->{slug}, 'announce');
+ $_announce_path = File::Spec->catfile($env->{out_dir}, 'announce', $release->{slug});
make_path(announce_path);
return 0;