orrg

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/orrg.git
Log | Files | Refs | README | LICENSE

commit 226986013afd88a8b39ef37d5b6f85b63107d1ee
parent 44e27d26947e61b9f2731ec9620ce4852a0b683c
Author: René Wagner <rwagner@rw-net.de>
Date:   Tue,  1 Dec 2020 12:35:47 +0100

remove trailing/leading whitespaces from title & link

Diffstat:
Morrg.pl | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/orrg.pl b/orrg.pl @@ -64,7 +64,13 @@ sub item my $hs = HTML::Strip->new(emit_spaces => 0, auto_reset => 1); my @item = (); - push @item, ($it->description ne '' || $it->pubDate ne '')? '### '. $it->title : $it->title; + my $title = $it->title; + my $link = $it->link; + $title =~ s/^\s+//ig; + $title =~ s/\s+$//ig; + $link =~ s/^\s+//ig; + $link =~ s/\s+$//ig; + push @item, ($it->description ne '' || $it->pubDate ne '')? '### '. $title : $title; if ($it->pubDate ne '') { my $dt = DateTime::Format::ISO8601->parse_datetime($it->pubDate); push @item, 'published '. strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($dt->epoch)); @@ -78,7 +84,7 @@ sub item $desc =~ s/^\s+\*/*/igm; push @item, $hs->parse($desc); } - $it->link eq '' or push @item, ('=> '.$it->link.' open entry in browser', ''); + $link eq '' or push @item, ('=> '.$link.' open entry in browser', ''); return \@item; }