Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 3
0
 def description_as_html(self):
     return markdown_renderer.render(self.blog_description)
Ejemplo n.º 4
0
def ajax_markdown_parser():
    return markdown_renderer.render(request.json)
Ejemplo n.º 5
0
 def description_as_html(self):
     return markdown_renderer.render(self.blog_description)
Ejemplo n.º 6
0
def ajax_markdown_parser():
    return markdown_renderer.render(request.json)