コード例 #1
0
ファイル: post.py プロジェクト: abhijitmamarde/MarkDownBlog
 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
ファイル: user.py プロジェクト: xzxldl55/MarkDownBlog
 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
ファイル: user.py プロジェクト: abhijitmamarde/MarkDownBlog
 def description_as_html(self):
     return markdown_renderer.render(self.blog_description)
コード例 #6
0
ファイル: post.py プロジェクト: abhijitmamarde/MarkDownBlog
def ajax_markdown_parser():
    return markdown_renderer.render(request.json)