Improved with ast2dict and ast2json and compatible with python2 and python3.#1
Improved with ast2dict and ast2json and compatible with python2 and python3.#1edelvalle wants to merge 4 commits intoYoloSwagTeam:masterfrom
Conversation
|
Hello, Thanks for your PR :) I've been trying to prettify the xml and while doing this, I've discovered that your code doesn't correctly escape strings which causes minidom to complain. You can test this by doing: My code is here: https://github.com/Psycojoker/ast2json/tree/xml_and_stuff I guess that we'll have to find a way to correctly escape the strings or to build the xml another way using a lib lke minidom https://docs.python.org/2/library/xml.dom.minidom.html My current (dirty) attempt to do this is: attrs.append('%(attr)s=%(value)s' % {"attr": attr, "value": json.dumps(value) if isinstance(value, basestring) else '"%s"' % value})for this line https://github.com/Psycojoker/ast2json/blob/943039a363c3fa0080c740c787c2243d6d61048c/ast2json.py#L87 and it's not a success at all. This new feature should also be added to the documentation. Kind regards, |
|
Hi, Ohh.. you are right... sorry. It will be nice to have a propper XML. We also need to add the I will check your code later. See you around, Ed. |
|
We also need to add the `pyyaml` dependency in the setup.py becuase I also added a YAML encoder.
I though about that but actually you haven't (no "ast2yaml"), you just
use it in the main.
But we can also add a ast2yaml :)
|
No description provided.