mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 16:40:36 +00:00
Merge pull request #1 from EvilDrPurple/recognize-whitespace
Recognize profile summary linebreaks + whitespace
This commit is contained in:
commit
b3e437fd18
2 changed files with 4 additions and 1 deletions
|
@ -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", "<style>.show-white-space{white-space:pre-wrap;}</style>"))
|
||||
self.output.append(("data", "<span class=\"show-white-space\">"))
|
||||
|
||||
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", "</span>"))
|
||||
if self.tag_stack:
|
||||
self.allow_html = False
|
||||
if not self.allow_html:
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<div>
|
||||
{% if user.summary %}
|
||||
{{ user.summary|to_markdown|safe|truncatechars_html:40 }}
|
||||
{{ user.summary|to_markdown|safe|truncatechars_html:81 }}
|
||||
{% else %} {% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue