예제 #1
0
def markdown(text, sanitize=True, linkify=True):
	html = text if is_html(text) else frappe.utils.md_to_html(text)

	if sanitize:
		html = html.replace("<!-- markdown -->", "")
		html = sanitize_html(html, linkify=linkify)

	return html
예제 #2
0
파일: utils.py 프로젝트: yered1/frappe
def add_comment(reference_doctype, reference_name, content, comment_email):
	"""allow any logged user to post a comment"""
	doc = frappe.get_doc(dict(
		doctype = 'Comment',
		reference_doctype = reference_doctype,
		reference_name = reference_name,
		content = sanitize_html(content),
		comment_email = comment_email,
		comment_type = 'Comment'
	)).insert(ignore_permissions = True)

	follow_document(doc.reference_doctype, doc.reference_name, frappe.session.user)
	return doc.as_dict()