cobrateam / django-htmlmin

HTML minifier for Python frameworks (not only Django, despite the name).
http://pypi.python.org/pypi/django-htmlmin
BSD 2-Clause "Simplified" License
542 stars 73 forks source link

HTML5 self-closing tags incorrectly become XHTML tags #37

Open meowgorithm opened 12 years ago

meowgorithm commented 12 years ago

I'm finding that, after going through the django-htmlmin middleware implicity self-closing tags (HTML5-style) are becoming explicity self-closed tags (XHTML-style).

For example the <meta> tag here…

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

…incorrectly becomes self-closing after going through the middleware:

<!DOCTYPE html><html><head><meta charset="utf-8" />
fsouza commented 11 years ago

Looks like bs4 still handles it wrongly, even with html5lib. I will take a look later.

moeffju commented 10 years ago

Why not simply use html5lib directly and use it to serialize the tree?