예제 #1
0
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if obj.is_html:
         obj.content_html = obj.content
     else:
         obj.content_html = restructuredtext(obj.content)
     obj.save()
예제 #2
0
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if obj.is_html:
         obj.content_html = obj.content
     else:
         obj.content_html = restructuredtext(obj.content)
     obj.save()
예제 #3
0
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if not obj.summary:
         obj.summary = obj.content
     if not obj.is_old:
         obj.content_html = restructuredtext(obj.content)
     else:
         obj.content_html = obj.content.replace('\r\n', '<br/>')
         import re
         obj.content_html = re.sub(r"\[cc lang='\w+?'\]", '<pre>', obj.content_html)
         obj.content_html = obj.content_html.replace('[/cc]', '</pre>')
     obj.save()
예제 #4
0
파일: adminx.py 프로젝트: jasper-zhang/blog
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if not obj.summary:
         obj.summary = obj.content
     if not obj.is_old:
         obj.content_html = restructuredtext(obj.content)
     else:
         obj.content_html = markdown.markdown(obj.content,['fenced_code', 'codehilite'])
         # obj.content_html = obj.content.replace('\r\n', '<br/>')
         # import re
         # obj.content_html = re.sub(r"\[cc lang='\w+?'\]", '<pre>', obj.content_html)
         # obj.content_html = obj.content_html.replace('[/cc]', '</pre>')
     obj.save()
예제 #5
0
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if not obj.summary:
         obj.summary = obj.content
     if not obj.is_old:
         obj.content_html = restructuredtext(obj.content)
     else:
         obj.content_html = obj.content.replace('\r\n', '<br/>')
         import re
         obj.content_html = re.sub(r"\[cc lang='\w+?'\]", '<pre>',
                                   obj.content_html)
         obj.content_html = obj.content_html.replace('[/cc]', '</pre>')
     obj.save()
예제 #6
0
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if not obj.summary:
         obj.summary = obj.content
     if not obj.is_old:
         obj.content_html = restructuredtext(obj.content)
     else:
         obj.content_html = markdown.markdown(obj.content,
                                              ['fenced_code', 'codehilite'])
         # obj.content_html = obj.content.replace('\r\n', '<br/>')
         # import re
         # obj.content_html = re.sub(r"\[cc lang='\w+?'\]", '<pre>', obj.content_html)
         # obj.content_html = obj.content_html.replace('[/cc]', '</pre>')
     obj.save()
예제 #7
0
 def save_models(self):
     obj = self.new_obj
     obj.author = self.request.user
     if not obj.summary:
         obj.summary = obj.content
     if not obj.is_old:
         obj.content_html = restructuredtext(obj.content)
     else:
         import markdown2
         obj.content_html = markdown2.markdown(
                 obj.content,
                 extras=["code-friendly","code-color","cuddled-lists",
                     "fenced-code-blocks","footnotes",
                     "markdown-in-html","metadata","nofollow","pyshell",
                     "smarty-pants","spoiler","toc","tables","use-file-vars",
                     "wiki-tables"])
         '''
         #obj.content_html = obj.content.replace('\r\n', '<br/>')
         #import re
         #obj.content_html = re.sub(r"\[cc lang='\w+?'\]", '<pre>', obj.content_html)
         #obj.content_html = obj.content_html.replace('[/cc]', '</pre>')
         '''
     obj.save()