Skip to content
Snippets Groups Projects
Commit d1dddb10 authored by grollicus's avatar grollicus
Browse files

ignore mastodon / matrix handles

parent fb93c503
No related branches found
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ class PageLink(SpanToken):
class ProfileLink(SpanToken):
pattern = re.compile(r'(?<!\S)@([-a-zA-Z0-9_]+)')
pattern = re.compile(r'(?<!\S)@([-a-zA-Z0-9_]+)(?=\s|$)')
parse_inner = False
def __init__(self, match):
......
......@@ -90,6 +90,10 @@ class MarkdownTest(TestCase):
self.assertEqual(render_markdown(conf, '@nonexisting_user'), '<p><a href="/en/user/nonexisting_user/" class="internal">@nonexisting_user</a></p>\n')
self.assertEqual(render_markdown(conf, 'foo@bar'), '<p>foo@bar</p>\n')
self.assertEqual(render_markdown(conf, '@"'), '<p>@"</p>\n')
# ignores element handles
self.assertEqual(render_markdown(conf, '@foo:bar.org'), '<p>@foo:bar.org</p>\n')
# ignores mastodon handles
self.assertEqual(render_markdown(conf, '@test@chaos.social'), '<p>@test@chaos.social</p>\n')
self.assertEqual(render_markdown_ex(conf, '@existing_user').linked_user_slugs, {'existing_user'})
self.assertEqual(render_markdown_ex(conf, '@nonexisting_user').linked_user_slugs, {'nonexisting_user'})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment