From 7af7a7b575ac763dbb5c58f0fe6bc93265e5374b Mon Sep 17 00:00:00 2001 From: Kylie Date: Fri, 30 Jul 2021 23:50:21 -0400 Subject: [PATCH 1/7] 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 %}
From f996cc7d1084fe321c919332d1daaeb95f7e9b2c Mon Sep 17 00:00:00 2001 From: Kylie <84819232+EvilDrPurple@users.noreply.github.com> Date: Sat, 31 Jul 2021 13:13:43 -0400 Subject: [PATCH 2/7] Revert "Recognize profile summary linebreaks + whitespace" --- bookwyrm/sanitize_html.py | 3 --- bookwyrm/templates/directory/user_card.html | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/bookwyrm/sanitize_html.py b/bookwyrm/sanitize_html.py index 1a8540e32..0be64c58c 100644 --- a/bookwyrm/sanitize_html.py +++ b/bookwyrm/sanitize_html.py @@ -26,8 +26,6 @@ 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""" @@ -58,7 +56,6 @@ 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 ca180dbce..c52c1f7ae 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:81 }} + {{ user.summary|to_markdown|safe|truncatechars_html:40 }} {% else %} {% endif %}
From f2186d6861b1e86ef580278ec699699972ae82e9 Mon Sep 17 00:00:00 2001 From: Kylie Date: Sat, 31 Jul 2021 13:15:49 -0400 Subject: [PATCH 3/7] Add preserve-whitespace CSS tag --- bookwyrm/static/css/bookwyrm.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bookwyrm/static/css/bookwyrm.css b/bookwyrm/static/css/bookwyrm.css index 3db25d1fe..8aa0530c8 100644 --- a/bookwyrm/static/css/bookwyrm.css +++ b/bookwyrm/static/css/bookwyrm.css @@ -72,6 +72,10 @@ body { flex-grow: 1; } +.preserve-whitespace p { + white-space: pre-wrap !important; +} + /** Shelving ******************************************************************************/ From d75f33cfb29347beb5826df882a57e1e29b3b320 Mon Sep 17 00:00:00 2001 From: Kylie Date: Sat, 31 Jul 2021 13:16:47 -0400 Subject: [PATCH 4/7] Apply preserve-whitespace to profile summaries --- bookwyrm/templates/directory/user_card.html | 2 +- bookwyrm/templates/user/layout.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bookwyrm/templates/directory/user_card.html b/bookwyrm/templates/directory/user_card.html index ca180dbce..34059fa6c 100644 --- a/bookwyrm/templates/directory/user_card.html +++ b/bookwyrm/templates/directory/user_card.html @@ -18,7 +18,7 @@ -
+
{% if user.summary %} {{ user.summary|to_markdown|safe|truncatechars_html:81 }} {% else %} {% endif %} diff --git a/bookwyrm/templates/user/layout.html b/bookwyrm/templates/user/layout.html index 69455806e..3897983b7 100644 --- a/bookwyrm/templates/user/layout.html +++ b/bookwyrm/templates/user/layout.html @@ -28,7 +28,7 @@
{% if user.summary %} -
+
{{ user.summary|to_markdown|safe }}
{% endif %} From 1c7ed30d65d6cbbab17070d1c849c09e885557f6 Mon Sep 17 00:00:00 2001 From: Kylie <84819232+EvilDrPurple@users.noreply.github.com> Date: Sat, 31 Jul 2021 19:54:59 -0400 Subject: [PATCH 5/7] Update sanitize_html.py --- bookwyrm/sanitize_html.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/bookwyrm/sanitize_html.py b/bookwyrm/sanitize_html.py index 1a8540e32..0be64c58c 100644 --- a/bookwyrm/sanitize_html.py +++ b/bookwyrm/sanitize_html.py @@ -26,8 +26,6 @@ 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""" @@ -58,7 +56,6 @@ 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: From 3f01cf87880d74d93de3e0b96fe87c71fdf1bf18 Mon Sep 17 00:00:00 2001 From: Kylie <84819232+EvilDrPurple@users.noreply.github.com> Date: Sat, 31 Jul 2021 19:58:12 -0400 Subject: [PATCH 6/7] Update user_card.html --- bookwyrm/templates/directory/user_card.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bookwyrm/templates/directory/user_card.html b/bookwyrm/templates/directory/user_card.html index 34059fa6c..3f7c10dee 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:81 }} + {{ user.summary|to_markdown|safe|truncatechars_html:40 }} {% else %} {% endif %}
From a6b8d44627c1e97ffa230dfcd5ef6d9283784365 Mon Sep 17 00:00:00 2001 From: Kylie Date: Sat, 31 Jul 2021 20:30:21 -0400 Subject: [PATCH 7/7] Summary display updates --- bookwyrm/static/css/bookwyrm.css | 4 ++++ bookwyrm/templates/directory/user_card.html | 2 +- bookwyrm/templates/user/layout.html | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bookwyrm/static/css/bookwyrm.css b/bookwyrm/static/css/bookwyrm.css index 8aa0530c8..d10fb9b7e 100644 --- a/bookwyrm/static/css/bookwyrm.css +++ b/bookwyrm/static/css/bookwyrm.css @@ -76,6 +76,10 @@ body { white-space: pre-wrap !important; } +.display-inline p { + display: inline !important; +} + /** Shelving ******************************************************************************/ diff --git a/bookwyrm/templates/directory/user_card.html b/bookwyrm/templates/directory/user_card.html index 3f7c10dee..b7941826b 100644 --- a/bookwyrm/templates/directory/user_card.html +++ b/bookwyrm/templates/directory/user_card.html @@ -18,7 +18,7 @@
-
+
{% if user.summary %} {{ user.summary|to_markdown|safe|truncatechars_html:40 }} {% else %} {% endif %} diff --git a/bookwyrm/templates/user/layout.html b/bookwyrm/templates/user/layout.html index 3897983b7..41d52812f 100644 --- a/bookwyrm/templates/user/layout.html +++ b/bookwyrm/templates/user/layout.html @@ -28,8 +28,10 @@
{% if user.summary %} + {% spaceless %}
{{ user.summary|to_markdown|safe }} + {% endspaceless %}
{% endif %}