Comment

Nadeem Afana

Hi,
I was trying your nice tool for compressing an XHTML file, but the compressor removes white-spaces from an attribute value (that is between double quotation marks).

I hope you can correct this,
Thanks!

Replies

Peter Bengtsson

Really?? That's a bug. Can you provide me with an example where it happens and I'll try to fix it.

Nadeem Afana

Here is an example:

<example attribute="This is a test." />

Nadeem Afana

Well, add spaces between the double quotation marks.

It seems that this tool removes spaces too.

Peter Bengtsson

I see the problem. It actually saves whitespace before and after but not inside the attribute. example (. replaces whitespace):

>>> from slimmer import html_slimmer
>>> html='''<example attribute="....This is....a test...." />'''
>>> html_slimmer(html)
'<example attribute="....This is a test...." />'

You're right. It is a bug.

However, I can't find the time to work on this now. To begin with, whitespace slimming on HTML is often less important since HTML is often regenerated every time unlike CSS and Javascript which is often more static and needs only to be slimmed once per build.

I've taken note of the bug but not going to commit any time to it now I'm afraid. Thanks for spotting it!