pyjade
pyjade copied to clipboard
problem with certain tag attributes
I've run across a problem where some of my tag attributes don't work properly. The error I get is
...
File "<string>", line 1
pyjade.runtime.attrs(attrs=[('name', ("valuePurchased" value="0")])
SyntaxError: invalid syntax
Now the tag itself looks like this
input(type="range" name="valuePurchased" value="0")
Clearly there is something wrong with how the parser is parsing the attributes as it's including the entire value attribute within the name attribute's value (it also happens when I switched the order of the name and value attributes). Now I thought it could be another error somewhere else in my jade that's resulting in an error here, as I've had that before, so I deleted the whole template file so was just this one line and I still got the exact same error.
I have something like this:
If input is like input.form__input(type="tel" placeholder="+7 999 999-99-99" required)
Compilation fails with
jinja2.exceptions.TemplateSyntaxError: expected token ')', got 'required'
after moving required attr to the beginning, for example
input.form__input(type="tel" required placeholder="+7 999 999-99-99")
Compilation works
It's not okey when I have only one attr and it's a conflict one, for example data
li.tabs-section__content-item(data-number="1")
Compilation fails with
jinja2.exceptions.TemplateSyntaxError: expected token ')', got 'data'