fds
This commit is contained in:
parent
a3663b7911
commit
c0f15ceeaf
1 changed files with 2 additions and 1 deletions
|
@ -5,13 +5,14 @@ from flask import g
|
||||||
from .markdown import *
|
from .markdown import *
|
||||||
from .sanitize import *
|
from .sanitize import *
|
||||||
from .const import *
|
from .const import *
|
||||||
|
from mistletoe.html_renderer import HTMLRenderer
|
||||||
|
|
||||||
def create_comment(text, autojanny=False):
|
def create_comment(text, autojanny=False):
|
||||||
if autojanny: author_id = AUTOJANNY_ID
|
if autojanny: author_id = AUTOJANNY_ID
|
||||||
else: author_id = NOTIFICATIONS_ID
|
else: author_id = NOTIFICATIONS_ID
|
||||||
|
|
||||||
text = text.replace('r/', 'r\/').replace('u/', 'u\/')
|
text = text.replace('r/', 'r\/').replace('u/', 'u\/')
|
||||||
text_html = sanitize(mistletoe.Document(text))
|
text_html = sanitize(HTMLRenderer().render(mistletoe.Document(text)))
|
||||||
new_comment = Comment(author_id=author_id,
|
new_comment = Comment(author_id=author_id,
|
||||||
parent_submission=None,
|
parent_submission=None,
|
||||||
distinguish_level=6,
|
distinguish_level=6,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue