From ec45f8d565977635b9a9a23e3bec6afce57d8edd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Thu, 12 Mar 2020 17:23:55 -0700 Subject: [PATCH] Allow a and span tags in posts Fixes #39 --- fedireads/sanitize_html.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fedireads/sanitize_html.py b/fedireads/sanitize_html.py index 020c0907..537e2c5f 100644 --- a/fedireads/sanitize_html.py +++ b/fedireads/sanitize_html.py @@ -6,7 +6,7 @@ class InputHtmlParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) - self.whitelist = ['p', 'b', 'i', 'pre'] + self.whitelist = ['p', 'b', 'i', 'pre', 'a', 'span'] self.tag_stack = [] self.output = [] # if the html appears invalid, we just won't allow any at all @@ -16,7 +16,7 @@ class InputHtmlParser(HTMLParser): def handle_starttag(self, tag, attrs): ''' check if the tag is valid ''' if self.allow_html and tag in self.whitelist: - self.output.append(('tag', '<%s>' % tag)) + self.output.append(('tag', self.get_starttag_text())) self.tag_stack.append(tag) else: self.output.append(('data', ' '))