An opinionated HTML/XML soup formatter
Project description
A tool to format in a very opinionated way HTML, XML and text containing XML snippets.
It satisfies a primary need: decrease the pain of diffing HTML/XML.
For this reason zpretty formats the markup following these rules of thumb:
maximize the vertical space/decrease the line length
attributes should be sorted consistently
attribute sorting is first semantic and then alphabetic
This tool understands the TAL language and has some features dedicated to it.
See TODO section to know what is forecast for the future.
The source code and the issue tracker are hosted on GitHub.
INSTALL
The suggested instal method is using pip:
$ pip install zpretty
USAGE
Basic usage:
zpretty [-h] [-i] [-z] [file [file ...]] positional arguments: file The list of files to prettify optional arguments: -h, --help show this help message and exit -i, --inplace Format files in place (overwrite existing file) -z, --zcml Follow the ZCML styleguide
Example:
zpretty hello_world.html
DEVELOP
$ git clone ... $ cd zpretty $ make
RUNNING TESTS
$ make test
TODO
[ ] Python 3 support … ;)
[ ] Command line options
[ ] Improve performances
[ ] Valueless attributes are not allowed in XML
[ ] Attributes are aligned in a strange way if previous sibling has no spaces
[ ] TBD: Style attributes should be multiline
[ ] Fix Not Close exception
Changelog
0.9.1 (2017-02-18)
Initial support for zcml style guide (#3). [ale-rt]
0.9.0 (2017-02-11)
Initial release. [ale-rt]