forked from mirrors/bookwyrm
Compare commits
3 commits
main
...
markdown-t
Author | SHA1 | Date | |
---|---|---|---|
e26ba3857c | |||
c022debee9 | |||
8605f5ac6b |
|
@ -16,6 +16,7 @@ from bookwyrm.tests.validate_html import validate_html
|
||||||
@patch("bookwyrm.lists_stream.populate_lists_task.delay")
|
@patch("bookwyrm.lists_stream.populate_lists_task.delay")
|
||||||
@patch("bookwyrm.activitystreams.remove_status_task.delay")
|
@patch("bookwyrm.activitystreams.remove_status_task.delay")
|
||||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async")
|
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.apply_async")
|
||||||
|
# pylint: disable=too-many-public-methods
|
||||||
class StatusViews(TestCase):
|
class StatusViews(TestCase):
|
||||||
"""viewing and creating statuses"""
|
"""viewing and creating statuses"""
|
||||||
|
|
||||||
|
@ -299,6 +300,12 @@ http://www.fish.com/"""
|
||||||
result = views.status.to_markdown(text)
|
result = views.status.to_markdown(text)
|
||||||
self.assertEqual(result, '<p><a href="http://fish.com">hi</a> ' "is rad</p>")
|
self.assertEqual(result, '<p><a href="http://fish.com">hi</a> ' "is rad</p>")
|
||||||
|
|
||||||
|
def test_to_markdown_hashtag(self, *_):
|
||||||
|
"""hashtags not titles"""
|
||||||
|
text = "#cool"
|
||||||
|
result = views.status.to_markdown(text)
|
||||||
|
self.assertEqual(result, "<p>#cool</p>")
|
||||||
|
|
||||||
def test_delete_status(self, mock, *_):
|
def test_delete_status(self, mock, *_):
|
||||||
"""marks a status as deleted"""
|
"""marks a status as deleted"""
|
||||||
view = views.DeleteStatus.as_view()
|
view = views.DeleteStatus.as_view()
|
||||||
|
|
|
@ -260,6 +260,7 @@ def _wrapped(text):
|
||||||
def to_markdown(content):
|
def to_markdown(content):
|
||||||
"""catch links and convert to markdown"""
|
"""catch links and convert to markdown"""
|
||||||
content = format_links(content)
|
content = format_links(content)
|
||||||
|
content = re.sub(r"\B#", "\\#", content)
|
||||||
content = markdown(content)
|
content = markdown(content)
|
||||||
# sanitize resulting html
|
# sanitize resulting html
|
||||||
sanitizer = InputHtmlParser()
|
sanitizer = InputHtmlParser()
|
||||||
|
|
Loading…
Reference in a new issue