forked from mirrors/bookwyrm
formatting
This commit is contained in:
parent
ac6438147d
commit
6e628fed38
2 changed files with 12 additions and 12 deletions
|
@ -305,18 +305,16 @@ class StatusViews(TestCase):
|
||||||
)
|
)
|
||||||
url = "https://tech.lgbt/@bookwyrm"
|
url = "https://tech.lgbt/@bookwyrm"
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
views.status.format_links(url),
|
views.status.format_links(url), '<a href="%s">tech.lgbt/@bookwyrm</a>' % url
|
||||||
'<a href="%s">tech.lgbt/@bookwyrm</a>' % url
|
|
||||||
)
|
)
|
||||||
url = "users.speakeasy.net/~lion/nb/book.pdf"
|
url = "users.speakeasy.net/~lion/nb/book.pdf"
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
views.status.format_links(url),
|
views.status.format_links(url),
|
||||||
'<a href="%s">users.speakeasy.net/~lion/nb/book.pdf</a>' % url
|
'<a href="%s">users.speakeasy.net/~lion/nb/book.pdf</a>' % url,
|
||||||
)
|
)
|
||||||
url = "pkm.one/#/page/The%20Book%20which%20launched%20a%201000%20Note%20taking%20apps"
|
url = "pkm.one/#/page/The%20Book%20which%20launched%20a%201000%20Note%20taking%20apps"
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
views.status.format_links(url),
|
views.status.format_links(url), '<a href="%s">%s</a>' % (url, url)
|
||||||
'<a href="%s">%s</a>' % (url, url)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_to_markdown(self, *_):
|
def test_to_markdown(self, *_):
|
||||||
|
|
|
@ -183,14 +183,16 @@ def format_links(content):
|
||||||
|
|
||||||
return formatted_content
|
return formatted_content
|
||||||
|
|
||||||
|
|
||||||
def _wrapped(text):
|
def _wrapped(text):
|
||||||
""" check if a line of text is wrapped in parentheses, square brackets or curly brackets. return wrapped status """
|
"""check if a line of text is wrapped in parentheses, square brackets or curly brackets. return wrapped status"""
|
||||||
wrappers = [("(", ")"), ("[","]"), ("{", "}")]
|
wrappers = [("(", ")"), ("[", "]"), ("{", "}")]
|
||||||
for w in wrappers:
|
for w in wrappers:
|
||||||
if text[0] == w[0] and text[-1] == w[-1]:
|
if text[0] == w[0] and text[-1] == w[-1]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def to_markdown(content):
|
def to_markdown(content):
|
||||||
"""catch links and convert to markdown"""
|
"""catch links and convert to markdown"""
|
||||||
content = markdown(content)
|
content = markdown(content)
|
||||||
|
|
Loading…
Reference in a new issue