-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 'master'
Release 0.19.0 See merge request prod-manager/prod-manager!125 Signed-off-by: Lunik <[email protected]>
- Loading branch information
Showing
63 changed files
with
1,833 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from flask import Markup | ||
from markupsafe import escape | ||
from jinja2 import pass_eval_context | ||
import markdown as md | ||
|
||
class Markdown: | ||
def __init__(self, app=None, auto_escape=False, **markdown_options): | ||
self.auto_escape = auto_escape | ||
self._instance = md.Markdown(**markdown_options) | ||
if app: | ||
self.init_app(app) | ||
|
||
def init_app(self, app): | ||
app.jinja_env.filters.setdefault( | ||
'markdown', self.__build_filter(self.auto_escape)) | ||
|
||
def __call__(self, stream): | ||
return Markup(self._instance.convert(stream)) | ||
|
||
def __build_filter(self, app_auto_escape): | ||
@pass_eval_context | ||
def markdown_filter(eval_ctx, stream): | ||
__filter = self | ||
if app_auto_escape and eval_ctx.autoescape: | ||
return Markup(__filter(escape(stream))) | ||
|
||
return Markup(__filter(stream)) | ||
|
||
return markdown_filter |
Oops, something went wrong.