Jinja: TemplateSyntaxError: expected token 'end of print statement'

Created on 10 Aug 2015  Â·  3Comments  Â·  Source: pallets/jinja

This is the script inlined in HTML.

!function(){{var t=navigator.userAgent.match(/android/gi),e=navigator.userAgent.match(/iphone|ipod/gi),n=navigator.userAgent.match(/ipad/gi);/MicroMessenger/gi.test(navigator.userAgent)}e||n?document.getElementById("prompt").classList.add("ios-prompt"):t&&document.getElementById("prompt").classList.add("android-prompt")}(window,document);

Error raised when render

TemplateSyntaxError: expected token 'end of print statement', got 't'

Most helpful comment

Weird, but this actually helped me. Thanks for posting it.

All 3 comments

How is this a jinja issue? You have {{ in your string (I think you wanted { instead) which has a special meaning in Jinja.

It was my error. (I assume the other fellow who reported the issue made a
similar error.)
I tried to retract my comment; I guess it stuck.
Thank you very much for checking.

On Wed, Sep 9, 2015 at 10:39 AM, Adrian [email protected] wrote:

How is this a jinja issue? You have {{ in your string which has a special
meaning in Jinja.

—
Reply to this email directly or view it on GitHub
https://github.com/mitsuhiko/jinja2/issues/477#issuecomment-138931445.

Weird, but this actually helped me. Thanks for posting it.

Was this page helpful?
0 / 5 - 0 ratings