A comment that is immediately opened and then closed results in IndexError.
>>> minify('<!---->')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/htmlmin/main.py", line 98, in minify
minifier.feed(input)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/HTMLParser.py", line 117, in feed
self.goahead(0)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/HTMLParser.py", line 165, in goahead
k = self.parse_comment(i)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/markupbase.py", line 178, in parse_comment
self.handle_comment(rawdata[i+4: j])
File "/usr/local/lib/python2.7/site-packages/htmlmin/parser.py", line 281, in handle_comment
data[1:] if data[0] == '!' else data))
IndexError: string index out of range
For now, I'm working around this issue by replacing those empty comments with <!-- --> before passing it to minify.
A comment that is immediately opened and then closed results in
IndexError
.For now, I'm working around this issue by replacing those empty comments with
<!-- -->
before passing it tominify
.