forked from rDrama/rDrama
master
parent
0eb9a96fb2
commit
6001464cea
|
@ -103,7 +103,8 @@ class CustomRenderer(HTMLRenderer):
|
|||
class Renderer(HTMLRenderer):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(SubMention,
|
||||
super().__init__(UserMention,
|
||||
SubMention,
|
||||
RedditorMention,
|
||||
SubMention2,
|
||||
RedditorMention2,
|
||||
|
@ -112,6 +113,23 @@ class Renderer(HTMLRenderer):
|
|||
for i in kwargs:
|
||||
self.__dict__[i] = kwargs[i]
|
||||
|
||||
def render_user_mention(self, token):
|
||||
space = token.target[0]
|
||||
target = token.target[1]
|
||||
|
||||
user = get_user(target, graceful=True)
|
||||
|
||||
|
||||
try:
|
||||
if g.v.admin_level == 0 and g.v.any_block_exists(user):
|
||||
return f"{space}@{target}"
|
||||
except BaseException:
|
||||
pass
|
||||
|
||||
if not user: return f"{space}@{target}"
|
||||
|
||||
return f'{space}<a href="{user.url}" class="d-inline-block mention-user" data-original-name="{user.original_username}">@{user.username}</a>'
|
||||
|
||||
def render_sub_mention(self, token):
|
||||
space = token.target[0]
|
||||
target = token.target[1]
|
||||
|
|
Loading…
Reference in New Issue