8000 Normalize end-of-line characters · html5lib/html5lib-python@3b11ecf · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b11ecf

Browse files
committed
Normalize end-of-line characters
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%40785
1 parent a55aab4 commit 3b11ecf

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/filters/inject_meta_charset.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ def __iter__(self):
1818

1919
elif type == "EmptyTag":
2020
if token["name"].lower() == "meta":
21-
# replace charset with actual encoding
22-
has_http_equiv_content_type = False
21+
# replace charset with actual encoding
22+
has_http_equiv_content_type = False
2323
content_index = -1
24-
for i,(name,value) in enumerate(token["data"]):
24+
for i,(name,value) in enumerate(token["data"]):
2525
if name.lower() == 'charset':
2626
token["data"][i] = (u'charset', self.encoding)
27-
meta_found = True
28-
break
29-
elif name == 'http-equiv' and value.lower() == 'content-type':
30-
has_http_equiv_content_type = True
31-
elif name == 'content':
32-
content_index = i
33-
else:
34-
if has_http_equiv_content_type and content_index >= 0:
35-
token["data"][content_index] = (u'content', u'text/html; charset=%s' % self.encoding)
36-
meta_found = True
27+
meta_found = True
28+
break
29+
elif name == 'http-equiv' and value.lower() == 'content-type':
30+
has_http_equiv_content_type = True
31+
elif name == 'content':
32+
content_index = i
33+
else:
34+
if has_http_equiv_content_type and content_index >= 0:
35+
token["data"][content_index] = (u'content', u'text/html; charset=%s' % self.encoding)
36+
meta_found = True
3737

3838
elif token["name"].lower() == "head" and not meta_found:
3939
# insert meta into empty head

0 commit comments

Comments
 (0)
0