@@ -18,22 +18,22 @@ def __iter__(self):
18
18
19
19
elif type == "EmptyTag" :
20
20
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
23
23
content_index = - 1
24
- for i ,(name ,value ) in enumerate (token ["data" ]):
24
+ for i ,(name ,value ) in enumerate (token ["data" ]):
25
25
if name .lower () == 'charset' :
26
26
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
37
37
38
38
elif token ["name" ].lower () == "head" and not meta_found :
39
39
# insert meta into empty head
0 commit comments