Skip to main content

Escape curly braces in jinja template for use in JS frameworks

Project description

flask_escapejstv

Flask extension which provides a filter to escape "curly" braces {{ }} in Jinja templates for use in JavaScript frameworks as few Javascript frameworks use "curly" braces to display the value of an expression or variable.

Installing

Install and update using pip :

pip install Flask-EscapeJSe

To enable this filter in your flask app, register this extension.

from flask_escapejse import EscapeJSe

EscapeJSe(app)

Like other Flask extensions, you can register it lazily:

ejse = EscapeJSe()

def create_app():
    app = Flask(__name__)
    ejse.init_app(app)

Usage

{{ "js_variable_name"|jse }}

For more information on jinja filters, visit http://jinja.pocoo.org/docs/2.10/templates/#filters

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-EscapeJSe-0.1.0.tar.gz (2.0 kB view hashes)

Uploaded Source

Built Distribution

Flask_EscapeJSe-0.1.0-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page