pypugjs
pypugjs copied to clipboard
Double quotes in attribute (carry-over bug from pyjade issue #132)
- pypugjs version: 5.9.4
- Django version:
- Python version: any
- Operating System: linux
Description
In its current form, pyjade converts
div(ng-hide='status == "Live"') into
return ("'%s'" if '"' in string else '"%s"') % string or by escaping attributes. Normal jade turns such an attribute into:
I have submitted a patch for buildbot for it to miggrate from the unmaintained pyjade depedncy to your pypugjs package. It turns out they have an outstanding pyjade bug which affects them. I just checked your pypugjs code. The affected code (class Tag(Node) static() ) is identical aside from some minor formatting style changes.
So, that bug also still applies to your code.
https://github.com/syrusakbary/pyjade/issues/132
That's a rather old bug. 🙄 Could you submit a PR here? This way you can have a new version in minutes.
What about this workaround https://github.com/syrusakbary/pyjade/issues/132#issuecomment-30263351?
switching the quotes is often not an option because json requires double quotes, hence something like this cannot be done with pug right now
<div hx-get="/example" hx-headers='{"myHeader": "My Value"}'>Get Some HTML, Including A Custom Header in the Request</div>
Well, in case you manage to submit a PR, i will merge it.
please dont blindly merge it though :D i have no experience with the repo. i cant promise the code has no adverse regressions. But maybe with an experienced eye thats easy to judge. its just 2 lines commented out in the end. I can clean that up further if you think its correct.
It sounds like you did not run the tests?
85 failed tests :/
can you let me know how to run the tests? i dont have much time to invest into that unfortunately. but maybe i can spare a couple of hours today. I assume you also cant really look into it, right?
Can you give me a gist, what the idea behind this "static attribute" is so i can better understand how my change effects the codebase. if not i will try to grasp it myself.
You have to run
make test
i think i fixed all tests and added a new one reflecting the change
attr='value'
-> attr="value"
but attr='{"k": "v"}'
-> attr='{"k": "v"}'
New version has been published. You are welcome to test it .