From b7430f3b10cc7087ae1519c0d185fc31e89f839f Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Mon, 30 Dec 2019 22:35:05 +0100 Subject: [PATCH] add no_tags_in_toot configuration parameter to remove hashtags from toot --- feed2toot/confparse.py | 4 ++- feed2toot/confparsers/hashtags/__init__.py | 15 +++++++++++ feed2toot/confparsers/hashtags/nohashtags.py | 26 ++++++++++++++++++++ feed2toot/main.py | 2 +- feed2toot/message.py | 18 ++++++++------ 5 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 feed2toot/confparsers/hashtags/__init__.py create mode 100644 feed2toot/confparsers/hashtags/nohashtags.py diff --git a/feed2toot/confparse.py b/feed2toot/confparse.py index af31575..efc1dfb 100644 --- a/feed2toot/confparse.py +++ b/feed2toot/confparse.py @@ -30,6 +30,7 @@ import feedparser # feed2toot library imports from feed2toot.confparsers.cache import parsecache from feed2toot.confparsers.hashtaglist import parsehashtaglist +from feed2toot.confparsers.hashtags.nohashtags import parsenotagsintoot from feed2toot.confparsers.feedparser import parsefeedparser from feed2toot.confparsers.lock import parselock from feed2toot.confparsers.media import parsemedia @@ -99,9 +100,10 @@ class ConfParse: ########################### options['cachefile'], options['cache_limit'] = parsecache(self.clioptions.cachefile, config) ########################### - # the hashtag section + # the hashtaglist section ########################### options['hashtaglist'] = parsehashtaglist(self.clioptions.hashtaglist, config) + options['notagsintoot'] = parsenotagsintoot(config) ########################### # the media section ########################### diff --git a/feed2toot/confparsers/hashtags/__init__.py b/feed2toot/confparsers/hashtags/__init__.py new file mode 100644 index 0000000..d77b4df --- /dev/null +++ b/feed2toot/confparsers/hashtags/__init__.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +# vim:ts=4:sw=4:ft=python:fileencoding=utf-8 +# Copyright © 2017-2019 Carl Chenet +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see diff --git a/feed2toot/confparsers/hashtags/nohashtags.py b/feed2toot/confparsers/hashtags/nohashtags.py new file mode 100644 index 0000000..adcf448 --- /dev/null +++ b/feed2toot/confparsers/hashtags/nohashtags.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# Copyright © 2015-2019 Carl Chenet +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see tootmaxlen: return ''.join([finaltweet[0:-3], '...']) else: