diff --git a/files/helpers/alerts.py b/files/helpers/alerts.py
index 510dc369da..8f9aa5d82f 100644
--- a/files/helpers/alerts.py
+++ b/files/helpers/alerts.py
@@ -11,6 +11,10 @@ def create_comment(text, autojanny=False):
else: author_id = NOTIFICATIONS_ID
text_html = sanitize(Renderer2().render(mistletoe.Document(text)))
+
+ for i in re.finditer("^@((\w|-){1,25})", text_html):
+ text_html = text_html.replace(i.group(1), f'@{i.group(1)}')
+
new_comment = Comment(author_id=author_id,
parent_submission=None,
distinguish_level=6,
diff --git a/files/helpers/markdown.py b/files/helpers/markdown.py
index 7ce47e8fca..c3948b571e 100644
--- a/files/helpers/markdown.py
+++ b/files/helpers/markdown.py
@@ -13,52 +13,25 @@ class UserMention(SpanToken):
def __init__(self, match_obj):
self.target = (match_obj.group(1), match_obj.group(2))
-class UserMention2(SpanToken):
- pattern = re.compile("^@((\w|-){1,25})")
- parse_inner = False
- def __init__(self, match_obj):
- self.target = (match_obj.group(1))
-
class SubMention(SpanToken):
- pattern = re.compile("(^|\s|\n)r/(\w{3,25})")
+ pattern = re.compile("(^|\s|\n)(r/|/r/)(\w{3,25})")
parse_inner = False
def __init__(self, match_obj):
- self.target = (match_obj.group(1), match_obj.group(2))
+ self.target = (match_obj.group(2), match_obj.group(3))
class RedditorMention(SpanToken):
- pattern = re.compile("(^|\s|\n)u/((\w|-){3,25})")
+ pattern = re.compile("(^|\s|\n)(u/|/u/)((\w|-){3,25})")
parse_inner = False
def __init__(self, match_obj):
- self.target = (match_obj.group(1), match_obj.group(2))
-
-class SubMention2(SpanToken):
-
- pattern = re.compile("(^|\s|\n)/r/(\w{3,25})")
- parse_inner = False
- def __init__(self, match_obj):
- self.target = (match_obj.group(1), match_obj.group(2))
-
-class RedditorMention2(SpanToken):
-
- pattern = re.compile("(^|\s|\n)/u/((\w|-){3,25})")
- parse_inner = False
- def __init__(self, match_obj):
- self.target = (match_obj.group(1), match_obj.group(2))
+ self.target = (match_obj.group(2), match_obj.group(3))
class CustomRenderer(HTMLRenderer):
def __init__(self, **kwargs):
- super().__init__(UserMention,
- SubMention,
- RedditorMention,
- SubMention2,
- RedditorMention2,
- )
-
- for i in kwargs:
- self.__dict__[i] = kwargs[i]
+ super().__init__(UserMention, SubMention, RedditorMention)
+ for i in kwargs: self.__dict__[i] = kwargs[i]
def render_user_mention(self, token):
space = token.target[0]
@@ -85,15 +58,8 @@ class CustomRenderer(HTMLRenderer):
class Renderer(HTMLRenderer):
def __init__(self, **kwargs):
- super().__init__(UserMention,
- SubMention,
- RedditorMention,
- SubMention2,
- RedditorMention2,
- )
-
- for i in kwargs:
- self.__dict__[i] = kwargs[i]
+ super().__init__(UserMention, SubMention, RedditorMention)
+ for i in kwargs: self.__dict__[i] = kwargs[i]
def render_user_mention(self, token):
space = token.target[0]
@@ -118,17 +84,9 @@ class Renderer(HTMLRenderer):
class Renderer2(HTMLRenderer):
def __init__(self, **kwargs):
- super().__init__(UserMention2,
- UserMention,
- SubMention,
- RedditorMention,
- SubMention2,
- RedditorMention2)
+ super().__init__(UserMention, SubMention, RedditorMention)
for i in kwargs: self.__dict__[i] = kwargs[i]
- def render_user_mention2(self, token):
- return f'
@{token.target}'
-
def render_user_mention(self, token):
space = token.target[0]
target = token.target[1]
diff --git a/files/templates/authforms.html b/files/templates/authforms.html
index 3eb5e42aab..469beb064b 100644
--- a/files/templates/authforms.html
+++ b/files/templates/authforms.html
@@ -15,7 +15,7 @@
{% if v %}
-
+
{% if v.agendaposter %}
-
+
{% endif %}
diff --git a/files/templates/default.html b/files/templates/default.html
index ca2ced314f..8acc228b7d 100644
--- a/files/templates/default.html
+++ b/files/templates/default.html
@@ -7,7 +7,7 @@
{% if v %}
-
+
{% if v.agendaposter %}
-
+
{% endif %}
diff --git a/files/templates/log.html b/files/templates/log.html
index a9647d8439..24389f48fd 100644
--- a/files/templates/log.html
+++ b/files/templates/log.html
@@ -6,7 +6,7 @@
{% block content %}
{% if v %}
-
+
{% if v.agendaposter %}
-
+
{% endif %}