Skip to content

Commit 4e24584

Browse files
author
Juan Carlos
committed
Fix log
1 parent a1f6934 commit 4e24584

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

css_html_js_minify/html_minifier.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import re
99

10-
import logging as log
11-
1210

1311
__all__ = ('html_minify', )
1412

@@ -19,7 +17,6 @@ def condense_html_whitespace(html):
1917
>>> condense_html_whitespace('<i> <b> <a> test </a> </b> </i><br>')
2018
'<i><b><a> test </a></b></i><br>'
2119
""" # first space between tags, then empty new lines and in-between.
22-
log.debug("Removing unnecessary HTML White Spaces and Empty New Lines.")
2320
tagsStack = []
2421
split = re.split('(<\\s*pre.*>|<\\s*/\\s*pre\\s*>|<\\s*textarea.*>|<\\s*/\\s*textarea\\s*>)', html, flags=re.IGNORECASE)
2522
for i in range(0, len(split)):
@@ -56,7 +53,6 @@ def condense_style(html):
5653
>>> condense_style('<style type="text/css">*{border:0}</style><p>a b c')
5754
'<style>*{border:0}</style><p>a b c'
5855
""" # May look silly but Emmet does this and is wrong.
59-
log.debug("Condensing HTML Style CSS tags.")
6056
return html.replace('<style type="text/css">', '<style>').replace(
6157
"<style type='text/css'>", '<style>').replace(
6258
"<style type=text/css>", '<style>')
@@ -68,7 +64,6 @@ def condense_script(html):
6864
>>> condense_script('<script type="text/javascript"> </script><p>a b c')
6965
'<script> </script><p>a b c'
7066
""" # May look silly but Emmet does this and is wrong.
71-
log.debug("Condensing HTML Script JS tags.")
7267
return html.replace('<script type="text/javascript">', '<script>').replace(
7368
"<style type='text/javascript'>", '<script>').replace(
7469
"<style type=text/javascript>", '<script>')
@@ -80,7 +75,6 @@ def clean_unneeded_html_tags(html):
8075
>>> clean_unneeded_html_tags('a<body></img></td>b</th></tr></hr></br>c')
8176
'abc'
8277
"""
83-
log.debug("Removing unnecessary optional HTML tags.")
8478
for tag_to_remove in ("""</area> </base> <body> </body> </br> </col>
8579
</colgroup> </dd> </dt> <head> </head> </hr> <html> </html> </img>
8680
</input> </li> </link> </meta> </option> </param> <tbody> </tbody>
@@ -97,7 +91,6 @@ def remove_html_comments(html):
9791
>>> _+= "<!-- kill me please -->keep" ; remove_html_comments(_)
9892
'<!-- build:dev -->a<!-- endbuild -->b<!--[if IE 7]>c<![endif]--> keep'
9993
""" # Grunt uses comments to as build arguments, bad practice but still.
100-
log.debug("""Removing all unnecessary HTML comments.""")
10194
return re.compile(r'<!-- .*? -->', re.I).sub('', html)
10295

10396

@@ -107,7 +100,6 @@ def unquote_html_attributes(html):
107100
>>> unquote_html_attributes('<img width="9" height="5" data-foo="0" >')
108101
'<img width=9 height=5 data-foo=0 >'
109102
""" # data-foo=0> might cause errors on IE, we leave 1 space data-foo=0 >
110-
log.debug("Removing unnecessary Quotes on attributes of HTML tags.")
111103
# cache all regular expressions on variables before we enter the for loop.
112104
any_tag = re.compile(r"<\w.*?>", re.I | re.MULTILINE | re.DOTALL)
113105
space = re.compile(r' \s+|\s +', re.MULTILINE)
@@ -144,12 +136,10 @@ def html_minify(html, comments=False):
144136
>>> html_minify(' <p width="9" height="5" > <!-- a --> b </p> c <br> ')
145137
'<p width=9 height=5 > b c <br>'
146138
"""
147-
log.info("Compressing HTML...")
148139
html = remove_html_comments(html) if not comments else html
149140
html = condense_style(html)
150141
html = condense_script(html)
151142
html = clean_unneeded_html_tags(html)
152143
html = condense_html_whitespace(html)
153144
html = unquote_html_attributes(html)
154-
log.info("Finished compressing HTML !.")
155145
return html.strip()

0 commit comments

Comments
 (0)