I'm diving into Jade for the first time using PyJade so that I can use it within Flask (and Jinja2). So far everything seems to be working and compiling correctly, though I'm wondering if this is a bug in PyJade's translation?
I'm unable to inject ternary syntax into Jade without an error. I've tried it every way suggested here.
div(class=(form.name.errors.length===0 ? 'form-group' : 'form-group has-error'))
div(class="#{form.name.errors.length===0 ? 'form-group' : 'form-group has-error'}")
My error is always
TemplateSyntaxError: unexpected '='
or
TemplateSyntaxError: unexpected char u'?' at 693
Am I doing something wrong here?
Here's a simplified code snippet
doctype html
html(lang="en")
head
title= AwesomePage
body
form.form-horizontal(method="POST", action="/timeline")
div(class="#{form.name.errors.length===0 ? 'form-group' : 'form-group has-error'}")
div.col-sm-4
#{form.name(class="form-control")}
div(class="col-sm-offset-2 col-sm-4")
input(type="submit", class="btn btn-default", value="Add Vendor")