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

Commit54181f0

Browse files
committed
Fix some parse errors for 0.11
--HG--extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401166
1 parentea2e0a3 commit54181f0

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

‎src/html5lib/tokenizer.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,19 @@ def processSolidusInTag(self):
114114
an EmptyTag
115115
"""
116116

117+
rv=False
118+
117119
# We need to consume another character to make sure it's a ">"
118120
data=self.stream.char()
119121

120122
ifself.currentToken["type"]=="StartTag"anddata==u">":
121123
self.currentToken["type"]="EmptyTag"
124+
elifdata==EOF:
125+
self.tokenQueue.append({"type":"ParseError","data":
126+
"EOF following solidus"})
127+
self.state=self.states["data"]
128+
self.emitCurrentToken()
129+
rv=True
122130
else:
123131
self.tokenQueue.append({"type":"ParseError","data":
124132
"incorrectly-placed-solidus"})
@@ -127,6 +135,8 @@ def processSolidusInTag(self):
127135
# doesn't get lost...
128136
self.stream.unget(data)
129137

138+
returnrv
139+
130140
defconsumeNumberEntity(self,isHex):
131141
"""This function returns either U+FFFD or the character based on the
132142
decimal or hexadecimal representation. It also discards ";" if present.
@@ -524,8 +534,8 @@ def attributeNameState(self):
524534
elifdatainspaceCharacters:
525535
self.state=self.states["afterAttributeName"]
526536
elifdata==u"/":
527-
self.processSolidusInTag()
528-
self.state=self.states["beforeAttributeName"]
537+
ifnotself.processSolidusInTag():
538+
self.state=self.states["beforeAttributeName"]
529539
elifdata==u"'"ordata==u'"':
530540
self.tokenQueue.append({"type":"ParseError","data":
531541
"invalid-character-in-attribute-name"})
@@ -569,8 +579,8 @@ def afterAttributeNameState(self):
569579
self.currentToken["data"].append([data,""])
570580
self.state=self.states["attributeName"]
571581
elifdata==u"/":
572-
self.processSolidusInTag()
573-
self.state=self.states["beforeAttributeName"]
582+
ifnotself.processSolidusInTag():
583+
self.state=self.states["beforeAttributeName"]
574584
elifdata==EOF:
575585
self.tokenQueue.append({"type":"ParseError","data":
576586
"expected-end-of-tag-but-got-eof"})
@@ -666,8 +676,14 @@ def afterAttributeValueState(self):
666676
self.emitCurrentToken()
667677
self.state=self.states["data"]
668678
elifdata==u"/":
669-
self.processSolidusInTag()
670-
self.state=self.states["beforeAttributeName"]
679+
ifnotself.processSolidusInTag():
680+
self.state=self.states["beforeAttributeName"]
681+
elifdata==EOF:
682+
self.tokenQueue.append({"type":"ParseError","data":
683+
"unexpected-EOF-after-attribute-value"})
684+
self.emitCurrentToken()
685+
self.stream.unget(data)
686+
self.state=self.states["data"]
671687
else:
672688
self.tokenQueue.append({"type":"ParseError","data":
673689
"unexpected-character-after-attribute-value"})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp