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 70dfde6e6d1bc071379528ff85e97452ba341a7e
parent a09b98b4d50d664bce1dd9f206d4802754dd7abe
Author: René Wagner <rwagner@rw-net.de>
Date:   Thu, 26 Nov 2020 16:42:45 +0100

strip HTML tags from description

this removes all tags, we might want to convert
<li> tags and links to gemini markup later

all other fields despite description are left as they are

Diffstat:
MREADME.md | 3+++
Morrg.pl | 10+++++++---
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -30,3 +30,6 @@ Fetching feeds from gemini is currently not supported -> https://todo.sr.ht/~rwa - Perl >= 5.28 with modules - URI::Escape - XML::FeedPP + - DateTime + - DateTime::Format::ISO8601 + - HTML::Strip diff --git a/orrg.pl b/orrg.pl @@ -1,16 +1,17 @@ #!/usr/bin/perl # Copyright René Wagner 2020 # licenced under BSD 3-Clause licence -# https://git.sr.ht/~rwa/willgemini.support +# https://git.sr.ht/~rwa/orrg use strict; no warnings 'experimental'; use URI::Escape; use XML::FeedPP; +use HTML::Strip; use DateTime; use DateTime::Format::ISO8601; use POSIX qw(strftime); -use v5.10; + # enable UTF-8 mode for everything use utf8; binmode STDOUT, ':utf8'; @@ -78,7 +79,10 @@ sub create_response push @body, 'published '. strftime('%Y-%m-%dT%H:%M:%SZ', gmtime($dt->epoch)); } push @body, ''; - $it->description eq '' or push @body, $it->description; + if ($it->description ne '') { + my $hs = HTML::Strip->new(); + push @body, $hs->parse($it->description); + } $it->link eq '' or push @body, ('=> '.$it->link.' open entry in browser', ''); }