Thanks @zopyx for jumping in this thread.
The tool does not really improve the readability, it makes things worse.
The obtained readability looks good to me, at least in daily usage.
For sure it is far better than the one I sometimes find around.
Not everybody is using linters/prettifier for html, xml or pts and many times I find mixed indentation styles.
So I usually have better code when I use zpretty.
Before I was using an alias for:
tidy -xml -asxml -indent --indent-spaces 2 --indent-attributes y --wrap-attributes y --literal-attributes y --wrap 0
and it worked fine but was messing up the tal:defines attributes.
Do you have a source file example that is rendered in a poorly readable way?
Can you pass it to me so I can use it to improve the code.
Also: do you have some other tools that does a better job?
Personally I prefer a sorting where the tal:* attributes come first.
I read somewhere that designers like class to be the first one (do not ask me why).
Anyway sorting attributes in a different way can be easily controlled tweaking the parameters here:
it's also questionable if you want all attributes on a dedicated line
Attributes can be rendered in one line changing '\n' with ' ' here:
Adding a couple of command line switches and some code could easily adjust the behavior as you want.
Fact is that (I think you will easily agree with me) you do not want to have always attributes in one line.
TAL templates can have lots of attributes (it is called Template Attribute Language for some reason ).
Also regular HTML elements (e.g. "input") may have lots of attributes.
In order to produce a tool that works for everybody and in every case, some rules had to be decided.
I think the rules I decided were the best from my point of view.
Luckily, now the package is open sourced on github and published on PyPI (I added collective as a maintainer).
I am really open to listen for everybody opinion.