From 457e2c33150ee0566ad72b8797cc7f7bcfc114d4 Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Thu, 6 Mar 2025 20:11:51 -0500 Subject: [PATCH] feat: rewrote get_description to allow extra text Now if you want to add something to the end of the description, you can pass it via the addons parameter. Also moved a line that was duplicated to reduce the function length. --- discorss.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/discorss.py b/discorss.py index b0163f0..555c3e2 100755 --- a/discorss.py +++ b/discorss.py @@ -53,7 +53,6 @@ def get_description(feed, length=250, min_length=150, addons=None): break else: length -= 1 - desc = temporary_string[:length] except KeyError: temporary_string = str(feed["description"]) temporary_string = html_filter.sub("", temporary_string) @@ -62,7 +61,10 @@ def get_description(feed, length=250, min_length=150, addons=None): break else: length -= 1 - desc = temporary_string[:length] + + desc = temporary_string[:length] + if addons is not None: + desc = desc + str(addons) return desc