示例#1
0
文件: models.py 项目: lite/djsite
 def save(self, *args, **kwargs):
     if self.markup == "bbcode":
         self.body_html = bbmarkup.bbcode(self.body)
     elif self.markup == "markdown":
         self.body_html = unicode(Markdown(self.body, safe_mode="escape"))
         # self.body_html = markdown(self.body, 'safe')
     else:
         raise Exception("Invalid markup property: %s" % self.markup)
     self.body_html = urlize(self.body_html)
     if forum_settings.SMILES_SUPPORT:
         self.body_html = smiles(self.body_html)
     super(PrivateMessage, self).save(*args, **kwargs)
示例#2
0
文件: models.py 项目: lite/djsite
 def save(self, *args, **kwargs):
     if self.markup == 'bbcode':
         self.body_html = bbmarkup.bbcode(self.body)
     elif self.markup == 'markdown':
         self.body_html = unicode(Markdown(self.body, safe_mode='escape'))
         #self.body_html = markdown(self.body, 'safe')
     else:
         raise Exception('Invalid markup property: %s' % self.markup)
     self.body_html = urlize(self.body_html)
     if forum_settings.SMILES_SUPPORT:
         self.body_html = smiles(self.body_html)
     super(PrivateMessage, self).save(*args, **kwargs)
示例#3
0
文件: views.py 项目: lite/djsite
def post_preview(request):
    '''Preview for markitup'''

    markup = request.user.forum_profile.markup
    data = request.POST.get('data', '')
    if markup == 'bbcode':
        data = bbmarkup.bbcode(data)
    elif markup == 'markdown' and MARKDOWN_AVAILABLE:
        data = unicode(Markdown(data, safe_mode='escape'))
    else:
        raise Exception('Invalid markup property: %s' % markup)

    data = urlize(data)
    if forum_settings.SMILES_SUPPORT:
        data = smiles(data)
    return {'data': data}
示例#4
0
文件: views.py 项目: lite/djsite
def post_preview(request):
    '''Preview for markitup'''

    markup = request.user.forum_profile.markup
    data = request.POST.get('data', '')
    if markup == 'bbcode':
        data = bbmarkup.bbcode(data)
    elif markup == 'markdown' and MARKDOWN_AVAILABLE:
        data = unicode(Markdown(data, safe_mode='escape'))
    else:
        raise Exception('Invalid markup property: %s' % markup)

    data = urlize(data)
    if forum_settings.SMILES_SUPPORT:
        data = smiles(data)
    return {'data': data}