pyjade
pyjade copied to clipboard
Double quotes in attribute
In its current form, pyjade converts
div(ng-hide='status == "Live"')
into
<div ng-hide="status == "Live"")
This seems like incorrect behavior, since it returns incorrect html.
It seems like this can be fixed by changing line 124 of nodes.py to something like:
return ("'%s'" if '"' in string else '"%s"') % string
or by escaping attributes. Normal jade turns such an attribute into:
<div ng-hide="status="Live""
Let me know if I'm missing something or if this seems like a worthwhile fix.
Thanks!
You are right, just changing the behavior for printing the same quotes that appear should solve this bug.
You can also do something like this
div(ng-hide="status == 'Live'")
This bug is a problem when sharing the same jade files bw a JS project and python project (and JS is the main source) e.g for buildbot custom_template_dir: http://docs.buildbot.net/latest/manual/cfg-www.html#web-server
How is it difficult to fix?
+1 for fixing it