Skip to content

Commit 97ed427

Browse files
author
James Graham
committed
Make sure entities that represent spaces become space tokens
--HG-- extra : transplant_source : 3%95%88%AE%86%01%FA%8E%23%F3%0B%DB%40X%06%E9%D7%F6%8B%7E
1 parent 559cf5c commit 97ed427

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

html5lib/tokenizer.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ def entitiesStartingWith(name):
223223
if fromAttribute:
224224
self.currentToken["data"][-1][1] += output
225225
else:
226-
self.tokenQueue.append({"type": tokenTypes["Characters"], "data": output})
226+
if output in spaceCharacters:
227+
tokenType = "SpaceCharacters"
228+
else:
229+
tokenType = "Characters"
230+
self.tokenQueue.append({"type": tokenTypes[tokenType], "data": output})
227231

228232
def processEntityInAttribute(self, allowedChar):
229233
"""This method replaces the need for "entityInAttributeValueState".

0 commit comments

Comments
 (0)