Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6464fc4

Browse files
committed
Remove the tokenizer's unused case-converting options
1 parentd8d5bb6 commit6464fc4

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

‎html5lib/tokenizer.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,11 @@ class HTMLTokenizer(object):
3131
Points to HTMLInputStream object.
3232
"""
3333

34-
def__init__(self,stream,encoding=None,useChardet=True,
35-
lowercaseElementName=True,lowercaseAttrName=True,parser=None):
34+
def__init__(self,stream,encoding=None,useChardet=True,parser=None):
3635

3736
self.stream=HTMLInputStream(stream,encoding,True,useChardet)
3837
self.parser=parser
3938

40-
# Perform case conversions?
41-
self.lowercaseElementName=lowercaseElementName
42-
self.lowercaseAttrName=lowercaseAttrName
43-
4439
# Setup the initial tokenizer state
4540
self.escapeFlag=False
4641
self.lastFourChars= []
@@ -232,8 +227,7 @@ def emitCurrentToken(self):
232227
token=self.currentToken
233228
# Add token to the queue to be yielded
234229
if (token["type"]intagTokenTypes):
235-
ifself.lowercaseElementName:
236-
token["name"]=token["name"].translate(asciiUpper2Lower)
230+
token["name"]=token["name"].translate(asciiUpper2Lower)
237231
iftoken["type"]==tokenTypes["EndTag"]:
238232
iftoken["data"]:
239233
self.tokenQueue.append({"type":tokenTypes["ParseError"],
@@ -918,9 +912,8 @@ def attributeNameState(self):
918912
# Attributes are not dropped at this stage. That happens when the
919913
# start tag token is emitted so values can still be safely appended
920914
# to attributes, but we do want to report the parse error in time.
921-
ifself.lowercaseAttrName:
922-
self.currentToken["data"][-1][0]= (
923-
self.currentToken["data"][-1][0].translate(asciiUpper2Lower))
915+
self.currentToken["data"][-1][0]= (
916+
self.currentToken["data"][-1][0].translate(asciiUpper2Lower))
924917
forname,_inself.currentToken["data"][:-1]:
925918
ifself.currentToken["data"][-1][0]==name:
926919
self.tokenQueue.append({"type":tokenTypes["ParseError"],"data":

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp