Пример #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
 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()