Skip to content

jinja2.exceptions.TemplateAssertionError: no filter named 'nl2br' #39

Open
@Thorleon

Description

@Thorleon

Seems like there is a missing filter in autodoc_default.html , which results in error like:
raise TemplateAssertionError(msg, lineno, self.name, self.filename) jinja2.exceptions.TemplateAssertionError: no filter named 'nl2br'

Workaround for this is to add into Flask app:


    @app.template_filter()
    @evalcontextfilter
    def nl2br(eval_ctx, value):
        result = u'\n\n'.join(u'<p>%s</p>' % p.replace('\n', '<br>\n') \
                              for p in _paragraph_re.split(escape(value)))
        if eval_ctx.autoescape:
            result = Markup(result)
        return result

Python 3.6
pip freeze:
Flask==0.12.2
Jinja2==2.9.6
Flask-Autodoc==0.1.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions