From 7af7a7b575ac763dbb5c58f0fe6bc93265e5374b Mon Sep 17 00:00:00 2001 From: Kylie Date: Fri, 30 Jul 2021 23:50:21 -0400 Subject: [PATCH] Recognize profile summary linebreaks + whitespace --- bookwyrm/sanitize_html.py | 3 +++ bookwyrm/templates/directory/user_card.html | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/bookwyrm/sanitize_html.py b/bookwyrm/sanitize_html.py index 0be64c58c..1a8540e32 100644 --- a/bookwyrm/sanitize_html.py +++ b/bookwyrm/sanitize_html.py @@ -26,6 +26,8 @@ class InputHtmlParser(HTMLParser): # pylint: disable=abstract-method self.output = [] # if the html appears invalid, we just won't allow any at all self.allow_html = True + self.output.append(("data", "")) + self.output.append(("data", "")) def handle_starttag(self, tag, attrs): """check if the tag is valid""" @@ -56,6 +58,7 @@ class InputHtmlParser(HTMLParser): # pylint: disable=abstract-method def get_output(self): """convert the output from a list of tuples to a string""" + self.output.append(("data", "")) if self.tag_stack: self.allow_html = False if not self.allow_html: diff --git a/bookwyrm/templates/directory/user_card.html b/bookwyrm/templates/directory/user_card.html index c52c1f7ae..ca180dbce 100644 --- a/bookwyrm/templates/directory/user_card.html +++ b/bookwyrm/templates/directory/user_card.html @@ -20,7 +20,7 @@
{% if user.summary %} - {{ user.summary|to_markdown|safe|truncatechars_html:40 }} + {{ user.summary|to_markdown|safe|truncatechars_html:81 }} {% else %} {% endif %}