예제 #1
0
 def content_as_html(self, index=False):
     if self.user.blog_truncate_posts and index:
         content = markdown_renderer.render(self.content)
         try:
             truncated = content[:300 + content[300:].index(" ")]
             truncate_end = " [...]<br / ><a href='{url}'>Click here to read the full article</a>".format(
                 url=url_for('blog.get', user_slug=self.user.blog_slug, post_slug=self.title_slug)
             )
             return BeautifulSoup(truncated + truncate_end)
         except Exception as e:
             return content
     else:
         return markdown_renderer.render(self.content)
예제 #2
0
 def content_as_html(self, index=False):
     if self.user.blog_truncate_posts and index:
         content = markdown_renderer.render(self.content)
         try:
             truncated = content[:300 + content[300:].index(" ")]
             truncate_end = " [...]<br / ><a href='{url}'>Click here to read the full article</a>".format(
                 url=url_for('blog.get',
                             user_slug=self.user.blog_slug,
                             post_slug=self.title_slug))
             return BeautifulSoup(truncated + truncate_end)
         except Exception as e:
             return content
     else:
         return markdown_renderer.render(self.content)
예제 #3
0
 def description_as_html(self):
     return markdown_renderer.render(self.blog_description)
예제 #4
0
파일: post.py 프로젝트: daghan/MarkDownBlog
def ajax_markdown_parser():
    return markdown_renderer.render(request.json)
예제 #5
0
 def description_as_html(self):
     return markdown_renderer.render(self.blog_description)
예제 #6
0
def ajax_markdown_parser():
    return markdown_renderer.render(request.json)