commit 8d1d84dc5de30083cf64f405572ba62fe8d1da0a
parent 637126e743aa72c05564095f71020e57bb44b22f
Author: René Wagner <rwagner@rw-net.de>
Date: Wed, 25 Nov 2020 21:49:54 +0100
skip empty fields for avoid empty line bloat
channel image linked after description
Diffstat:
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/orrg.pl b/orrg.pl
@@ -64,18 +64,17 @@ sub create_response
push @body, '# '. $feed->title;
push @body, 'fetched '. strftime('%Y-%m-%dT%H:%M:%SZ', gmtime());
- push @body, ('', $feed->description);
- push @body, ('=> '.$feed->link.' open website', '');
+ $feed->description eq '' or push @body, ('', $feed->description);
+ $feed->image eq '' or push @body, '=> '. $feed->image .' feed image';
+ $feed->link eq '' or push @body, ('=> '.$feed->link.' open website', '');
push @body, ('## recent feed items', '');
foreach my $it ($feed->get_item()) {
push @body, '### '. $it->title;
- push @body, 'published '. $it->pubDate;
+ $it->pubDate eq '' or push @body, 'published '. $it->pubDate;
push @body, '';
- if ( $it->get('description') ne '') {
- push @body, $it->description;
- }
- push @body, ('=> '.$it->link.' open entry in browser', '');
+ $it->description eq '' or push @body, $it->description;
+ $it->link eq '' or push @body, ('=> '.$it->link.' open entry in browser', '');
}
return @body;