mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-02-20 12:56:18 +00:00
Merge pull request #604 from mouse-reeve/link-format-bug
Link format bug
This commit is contained in:
commit
222dc118af
2 changed files with 11 additions and 2 deletions
|
@ -217,6 +217,16 @@ class StatusViews(TestCase):
|
||||||
'is rad</p>')
|
'is rad</p>')
|
||||||
|
|
||||||
|
|
||||||
|
def test_to_markdown_link(self):
|
||||||
|
''' this is mostly handled in other places, but nonetheless '''
|
||||||
|
text = '[hi](http://fish.com) is <marquee>rad</marquee>'
|
||||||
|
result = views.status.to_markdown(text)
|
||||||
|
self.assertEqual(
|
||||||
|
result,
|
||||||
|
'<p><a href="http://fish.com">hi</a> ' \
|
||||||
|
'is rad</p>')
|
||||||
|
|
||||||
|
|
||||||
def test_handle_delete_status(self):
|
def test_handle_delete_status(self):
|
||||||
''' marks a status as deleted '''
|
''' marks a status as deleted '''
|
||||||
view = views.DeleteStatus.as_view()
|
view = views.DeleteStatus.as_view()
|
||||||
|
|
|
@ -48,7 +48,6 @@ class CreateStatus(View):
|
||||||
r'<a href="%s">%s</a>\g<1>' % \
|
r'<a href="%s">%s</a>\g<1>' % \
|
||||||
(mention_user.remote_id, mention_text),
|
(mention_user.remote_id, mention_text),
|
||||||
content)
|
content)
|
||||||
|
|
||||||
# add reply parent to mentions and notify
|
# add reply parent to mentions and notify
|
||||||
if status.reply_parent:
|
if status.reply_parent:
|
||||||
status.mention_users.add(status.reply_parent.user)
|
status.mention_users.add(status.reply_parent.user)
|
||||||
|
@ -126,8 +125,8 @@ def format_links(content):
|
||||||
|
|
||||||
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 = markdown(content)
|
content = markdown(content)
|
||||||
|
content = format_links(content)
|
||||||
# sanitize resulting html
|
# sanitize resulting html
|
||||||
sanitizer = InputHtmlParser()
|
sanitizer = InputHtmlParser()
|
||||||
sanitizer.feed(content)
|
sanitizer.feed(content)
|
||||||
|
|
Loading…
Reference in a new issue