def body_formatted(self):
"""
An escaped and formatted body of the comment with \n replaced by HTML <br>
"""
#body = escape.xhtml_escape(self.body)
#print body
#body = escape.linkify(body, True) #someday?
#for now use Bleach
#bl = Bleach()
#body = bl.linkify(body, nofollow=True)
#body = body.replace('</a>/', '/</a>')
#body = body.replace('<a href=', '<a target="_blank" href=')
body = escape.linkify(self.body, True, extra_params='rel="nofollow" target="_blank"')
body = body.replace('\n', '<br>')
return body
评论列表
文章目录