Skip to content

Commit

Permalink
Adicionando Markdown template global 🐹
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno committed Oct 2, 2017
1 parent fc5b734 commit 9d2202b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 6 additions & 0 deletions cms/ext/markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from mistune import markdown


def configure(app):
# adiciona {{ markdown('texto) }} para os templates
app.add_template_global(markdown)
13 changes: 7 additions & 6 deletions cms/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ CMS:
DB_NAME: cms_db

SITENAME: Flask CMS
# TITLE: Hello
# DESCRIPTION: Awesome Blog
# ABOUT: This is my blog, I am xyz
# LINKS:
# - ['Github', 'http://github.com']
# - ['Twitter', 'http://twitter.com']
TITLE: Hello
DESCRIPTION: Awesome Blog
ABOUT: This is my blog, I am xyz
LINKS:
- ['Github', 'http://github.com']
- ['Twitter', 'http://twitter.com']

HOST: '0.0.0.0'
PORT: 5000
Expand All @@ -22,6 +22,7 @@ CMS:
- cms.ext.debug.configure
- cms.ext.blog.configure
- flask_bootstrap.Bootstrap
- cms.ext.markdown.configure

DEBUG_TOOLBAR_ENABLED: true
DEBUG_TB_INTERCEPT_REDIRECTS: false
Expand Down
2 changes: 1 addition & 1 deletion cms/templates/navbar.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<a class="navbar-brand" href="#">{{config.SITENAME}}</a>
<a class="navbar-brand" href="{{url_for('blog.index')}}">{{config.SITENAME}}</a>
</div>
<ul class="nav navbar-nav">
<li class="active"><a href="{{url_for('blog.index')}}">Home</a></li>
Expand Down
2 changes: 1 addition & 1 deletion cms/templates/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h1 class="blog-title">{{post.titulo}}</h1>
{% block main %}
<div class="blog-post">
<p class="blog-post-meta">Por <a href="#">{{post.autor}}</a></p>
<p>{{ post.texto }}</p>
<p>{{ markdown(post.texto) | safe }}</p>
</div><!-- /.blog-post -->
{% endblock %}

0 comments on commit 9d2202b

Please sign in to comment.