Skip to content

Commit 907bde2

Browse files
author
James Graham
committed
Don't make entities in attributes if they are followed by an =
1 parent b856aee commit 907bde2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

html5lib/tokenizer.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ def consumeEntity(self, allowedChar=None, fromAttribute=False):
184184
def entitiesStartingWith(name):
185185
return [e for e in filteredEntityList if e.startswith(name)]
186186

187-
while charStack[-1] is not EOF and\
188-
entitiesStartingWith("".join(charStack)):
187+
while (charStack[-1] is not EOF and
188+
entitiesStartingWith("".join(charStack))):
189189
charStack.append(self.stream.char())
190190

191191
# At this point we have a string that starts with some characters
@@ -204,9 +204,10 @@ def entitiesStartingWith(name):
204204
if entityName[-1] != ";":
205205
self.tokenQueue.append({"type": tokenTypes["ParseError"], "data":
206206
"named-entity-without-semicolon"})
207-
if entityName[-1] != ";" and fromAttribute and \
208-
(charStack[entityLength] in asciiLetters
209-
or charStack[entityLength] in digits):
207+
if (entityName[-1] != ";" and fromAttribute and
208+
(charStack[entityLength] in asciiLetters or
209+
charStack[entityLength] in digits or
210+
charStack[entityLength] == "=")):
210211
self.stream.unget(charStack.pop())
211212
output = u"&" + u"".join(charStack)
212213
else:

0 commit comments

Comments
 (0)