Lines Matching refs:token

166         for token in self.normalizedTokens():
167 new_token = token
183 token["name"] not in frozenset(["mglyph", "malignmark"])) or
187 token["name"] == "svg") or
207 if (type == StartTagToken and token["selfClosing"]
208 and not token["selfClosingAcknowledged"]):
210 {"name": token["name"]})
222 for token in self.tokenizer:
223 yield self.normalizeToken(token)
262 def normalizeToken(self, token): argument
265 if token["type"] == tokenTypes["StartTag"]:
266 token["data"] = dict(token["data"][::-1])
268 return token
270 def adjustMathMLAttributes(self, token): argument
273 if k in token["data"]:
274 token["data"][v] = token["data"][k]
275 del token["data"][k]
277 def adjustSVGAttributes(self, token): argument
342 for originalName in list(token["data"].keys()):
345 token["data"][svgName] = token["data"][originalName]
346 del token["data"][originalName]
348 def adjustForeignAttributes(self, token): argument
351 for originalName in token["data"].keys():
354 token["data"][foreignName] = token["data"][originalName]
355 del token["data"][originalName]
357 def reparseTokenNormal(self, token): argument
404 def parseRCDataRawtext(self, token, contentType): argument
410 self.tree.insertElement(token)
430 token = args[0]
432 info = {"type": type_names[token['type']]}
435 if token['type'] in constants.tagTokenTypes:
436 info["name"] = token['name']
465 def processComment(self, token): argument
468 self.tree.insertComment(token, self.tree.openElements[-1])
470 def processDoctype(self, token): argument
473 def processCharacters(self, token): argument
474 self.tree.insertText(token["data"])
476 def processSpaceCharacters(self, token): argument
477 self.tree.insertText(token["data"])
479 def processStartTag(self, token): argument
480 return self.startTagHandler[token["name"]](token)
482 def startTagHtml(self, token): argument
483 if not self.parser.firstStartTag and token["name"] == "html":
487 for attr, value in token["data"].items():
492 def processEndTag(self, token): argument
493 return self.endTagHandler[token["name"]](token)
496 def processSpaceCharacters(self, token): argument
499 def processComment(self, token): argument
500 self.tree.insertComment(token, self.tree.document)
502 def processDoctype(self, token): argument
503 name = token["name"]
504 publicId = token["publicId"]
505 systemId = token["systemId"]
506 correct = token["correct"]
515 self.tree.insertDoctype(token)
520 if (not correct or token["name"] != "html"
602 def processCharacters(self, token): argument
605 return token
607 def processStartTag(self, token): argument
609 {"name": token["name"]})
611 return token
613 def processEndTag(self, token): argument
615 {"name": token["name"]})
617 return token
635 def processComment(self, token): argument
636 self.tree.insertComment(token, self.tree.document)
638 def processSpaceCharacters(self, token): argument
641 def processCharacters(self, token): argument
643 return token
645 def processStartTag(self, token): argument
646 if token["name"] == "html":
649 return token
651 def processEndTag(self, token): argument
652 if token["name"] not in ("head", "body", "html", "br"):
654 {"name": token["name"]})
657 return token
678 def processSpaceCharacters(self, token): argument
681 def processCharacters(self, token): argument
683 return token
685 def startTagHtml(self, token): argument
686 return self.parser.phases["inBody"].processStartTag(token)
688 def startTagHead(self, token): argument
689 self.tree.insertElement(token)
693 def startTagOther(self, token): argument
695 return token
697 def endTagImplyHead(self, token): argument
699 return token
701 def endTagOther(self, token): argument
703 {"name": token["name"]})
732 def processCharacters(self, token): argument
734 return token
736 def startTagHtml(self, token): argument
737 return self.parser.phases["inBody"].processStartTag(token)
739 def startTagHead(self, token): argument
742 def startTagBaseLinkCommand(self, token): argument
743 self.tree.insertElement(token)
745 token["selfClosingAcknowledged"] = True
747 def startTagMeta(self, token): argument
748 self.tree.insertElement(token)
750 token["selfClosingAcknowledged"] = True
752 attributes = token["data"]
768 def startTagTitle(self, token): argument
769 self.parser.parseRCDataRawtext(token, "RCDATA")
771 def startTagNoScriptNoFramesStyle(self, token): argument
773 self.parser.parseRCDataRawtext(token, "RAWTEXT")
775 def startTagScript(self, token): argument
776 self.tree.insertElement(token)
781 def startTagOther(self, token): argument
783 return token
785 def endTagHead(self, token): argument
790 def endTagHtmlBodyBr(self, token): argument
792 return token
794 def endTagOther(self, token): argument
795 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
826 def processCharacters(self, token): argument
828 return token
830 def startTagHtml(self, token): argument
831 return self.parser.phases["inBody"].processStartTag(token)
833 def startTagBody(self, token): argument
835 self.tree.insertElement(token)
838 def startTagFrameset(self, token): argument
839 self.tree.insertElement(token)
842 def startTagFromHead(self, token): argument
844 {"name": token["name"]})
846 self.parser.phases["inHead"].processStartTag(token)
852 def startTagHead(self, token): argument
853 self.parser.parseError("unexpected-start-tag", {"name": token["name"]})
855 def startTagOther(self, token): argument
857 return token
859 def endTagHtmlBodyBr(self, token): argument
861 return token
863 def endTagOther(self, token): argument
864 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
958 def addFormattingElement(self, token): argument
959 self.tree.insertElement(token)
985 def processSpaceCharactersDropNewline(self, token): argument
988 data = token["data"]
998 def processCharacters(self, token): argument
999 if token["data"] == "\u0000":
1003 self.tree.insertText(token["data"])
1007 for char in token["data"]])):
1010 def processSpaceCharacters(self, token): argument
1012 self.tree.insertText(token["data"])
1014 def startTagProcessInHead(self, token): argument
1015 return self.parser.phases["inHead"].processStartTag(token)
1017 def startTagBody(self, token): argument
1024 for attr, value in token["data"].items():
1028 def startTagFrameset(self, token): argument
1039 self.tree.insertElement(token)
1042 def startTagCloseP(self, token): argument
1045 self.tree.insertElement(token)
1047 def startTagPreListing(self, token): argument
1050 self.tree.insertElement(token)
1054 def startTagForm(self, token): argument
1060 self.tree.insertElement(token)
1063 def startTagListItem(self, token): argument
1069 stopNames = stopNamesMap[token["name"]]
1083 self.tree.insertElement(token)
1085 def startTagPlaintext(self, token): argument
1088 self.tree.insertElement(token)
1091 def startTagHeading(self, token): argument
1095 self.parser.parseError("unexpected-start-tag", {"name": token["name"]})
1097 self.tree.insertElement(token)
1099 def startTagA(self, token): argument
1110 self.addFormattingElement(token)
1112 def startTagFormatting(self, token): argument
1114 self.addFormattingElement(token)
1116 def startTagNobr(self, token): argument
1124 self.addFormattingElement(token)
1126 def startTagButton(self, token): argument
1131 return token
1134 self.tree.insertElement(token)
1137 def startTagAppletMarqueeObject(self, token): argument
1139 self.tree.insertElement(token)
1143 def startTagXmp(self, token): argument
1148 self.parser.parseRCDataRawtext(token, "RAWTEXT")
1150 def startTagTable(self, token): argument
1154 self.tree.insertElement(token)
1158 def startTagVoidFormatting(self, token): argument
1160 self.tree.insertElement(token)
1162 token["selfClosingAcknowledged"] = True
1165 def startTagInput(self, token): argument
1167 self.startTagVoidFormatting(token)
1168 if ("type" in token["data"] and
1169 token["data"]["type"].translate(asciiUpper2Lower) == "hidden"):
1173 def startTagParamSource(self, token): argument
1174 self.tree.insertElement(token)
1176 token["selfClosingAcknowledged"] = True
1178 def startTagHr(self, token): argument
1181 self.tree.insertElement(token)
1183 token["selfClosingAcknowledged"] = True
1186 def startTagImage(self, token): argument
1191 attributes=token["data"],
1192 selfClosing=token["selfClosing"]))
1194 def startTagIsIndex(self, token): argument
1199 if "action" in token["data"]:
1200 form_attrs["action"] = token["data"]["action"]
1206 if "prompt" in token["data"]:
1207 prompt = token["data"]["prompt"]
1212 attributes = token["data"].copy()
1220 selfClosing=token["selfClosing"]))
1225 def startTagTextarea(self, token): argument
1226 self.tree.insertElement(token)
1231 def startTagIFrame(self, token): argument
1233 self.startTagRawtext(token)
1235 def startTagRawtext(self, token): argument
1237 self.parser.parseRCDataRawtext(token, "RAWTEXT")
1239 def startTagOpt(self, token): argument
1243 self.parser.tree.insertElement(token)
1245 def startTagSelect(self, token): argument
1247 self.tree.insertElement(token)
1259 def startTagRpRt(self, token): argument
1264 self.tree.insertElement(token)
1266 def startTagMath(self, token): argument
1268 self.parser.adjustMathMLAttributes(token)
1269 self.parser.adjustForeignAttributes(token)
1270 token["namespace"] = namespaces["mathml"]
1271 self.tree.insertElement(token)
1274 if token["selfClosing"]:
1276 token["selfClosingAcknowledged"] = True
1278 def startTagSvg(self, token): argument
1280 self.parser.adjustSVGAttributes(token)
1281 self.parser.adjustForeignAttributes(token)
1282 token["namespace"] = namespaces["svg"]
1283 self.tree.insertElement(token)
1286 if token["selfClosing"]:
1288 token["selfClosingAcknowledged"] = True
1290 def startTagMisplaced(self, token): argument
1297 self.parser.parseError("unexpected-start-tag-ignored", {"name": token["name"]})
1299 def startTagOther(self, token): argument
1301 self.tree.insertElement(token)
1303 def endTagP(self, token): argument
1316 def endTagBody(self, token): argument
1334 def endTagHtml(self, token): argument
1338 return token
1340 def endTagBlock(self, token): argument
1342 if token["name"] == "pre":
1344 inScope = self.tree.elementInScope(token["name"])
1347 if self.tree.openElements[-1].name != token["name"]:
1348 self.parser.parseError("end-tag-too-early", {"name": token["name"]})
1351 while node.name != token["name"]:
1354 def endTagForm(self, token): argument
1367 def endTagListItem(self, token): argument
1368 if token["name"] == "li":
1372 if not self.tree.elementInScope(token["name"], variant=variant):
1373 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
1375 self.tree.generateImpliedEndTags(exclude=token["name"])
1376 if self.tree.openElements[-1].name != token["name"]:
1379 {"name": token["name"]})
1381 while node.name != token["name"]:
1384 def endTagHeading(self, token): argument
1389 if self.tree.openElements[-1].name != token["name"]:
1390 self.parser.parseError("end-tag-too-early", {"name": token["name"]})
1399 def endTagFormatting(self, token): argument
1422 token["name"])
1429 self.endTagOther(token)
1437 self.parser.parseError("adoption-agency-1.2", {"name": token["name"]})
1446 self.parser.parseError("adoption-agency-4.4", {"name": token["name"]})
1456 self.parser.parseError("adoption-agency-1.3", {"name": token["name"]})
1562 def endTagAppletMarqueeObject(self, token): argument
1563 if self.tree.elementInScope(token["name"]):
1565 if self.tree.openElements[-1].name != token["name"]:
1566 self.parser.parseError("end-tag-too-early", {"name": token["name"]})
1568 if self.tree.elementInScope(token["name"]):
1570 while element.name != token["name"]:
1574 def endTagBr(self, token): argument
1581 def endTagOther(self, token): argument
1583 if node.name == token["name"]:
1584 self.tree.generateImpliedEndTags(exclude=token["name"])
1585 if self.tree.openElements[-1].name != token["name"]:
1586 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
1592 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
1604 def processCharacters(self, token): argument
1605 self.tree.insertText(token["data"])
1614 def startTagOther(self, token): argument
1615 assert False, "Tried to process start tag %s in RCDATA/RAWTEXT mode" % token['name']
1617 def endTagScript(self, token): argument
1624 def endTagOther(self, token): argument
1670 def processSpaceCharacters(self, token): argument
1674 self.parser.phase.processSpaceCharacters(token)
1676 def processCharacters(self, token): argument
1680 self.parser.phase.processCharacters(token)
1682 def insertText(self, token): argument
1686 self.parser.phases["inBody"].processCharacters(token)
1689 def startTagCaption(self, token): argument
1692 self.tree.insertElement(token)
1695 def startTagColgroup(self, token): argument
1697 self.tree.insertElement(token)
1700 def startTagCol(self, token): argument
1702 return token
1704 def startTagRowGroup(self, token): argument
1706 self.tree.insertElement(token)
1709 def startTagImplyTbody(self, token): argument
1711 return token
1713 def startTagTable(self, token): argument
1718 return token
1720 def startTagStyleScript(self, token): argument
1721 return self.parser.phases["inHead"].processStartTag(token)
1723 def startTagInput(self, token): argument
1724 if ("type" in token["data"] and
1725 token["data"]["type"].translate(asciiUpper2Lower) == "hidden"):
1727 self.tree.insertElement(token)
1731 self.startTagOther(token)
1733 def startTagForm(self, token): argument
1736 self.tree.insertElement(token)
1740 def startTagOther(self, token): argument
1741 … self.parser.parseError("unexpected-start-tag-implies-table-voodoo", {"name": token["name"]})
1744 self.parser.phases["inBody"].processStartTag(token)
1747 def endTagTable(self, token): argument
1763 def endTagIgnore(self, token): argument
1764 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
1766 def endTagOther(self, token): argument
1767 … self.parser.parseError("unexpected-end-tag-implies-table-voodoo", {"name": token["name"]})
1770 self.parser.phases["inBody"].processEndTag(token)
1782 token = {"type": tokenTypes["Characters"], "data": data}
1783 self.parser.phases["inTable"].insertText(token)
1788 def processComment(self, token): argument
1791 return token
1798 def processCharacters(self, token): argument
1799 if token["data"] == "\u0000":
1801 self.characterTokens.append(token)
1803 def processSpaceCharacters(self, token): argument
1805 self.characterTokens.append(token)
1808 def processStartTag(self, token): argument
1811 return token
1813 def processEndTag(self, token): argument
1816 return token
1844 def processCharacters(self, token): argument
1845 return self.parser.phases["inBody"].processCharacters(token)
1847 def startTagTableElement(self, token): argument
1853 return token
1855 def startTagOther(self, token): argument
1856 return self.parser.phases["inBody"].processStartTag(token)
1858 def endTagCaption(self, token): argument
1876 def endTagTable(self, token): argument
1881 return token
1883 def endTagIgnore(self, token): argument
1884 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
1886 def endTagOther(self, token): argument
1887 return self.parser.phases["inBody"].processEndTag(token)
1920 def processCharacters(self, token): argument
1924 return token
1926 def startTagCol(self, token): argument
1927 self.tree.insertElement(token)
1930 def startTagOther(self, token): argument
1934 return token
1936 def endTagColgroup(self, token): argument
1945 def endTagCol(self, token): argument
1948 def endTagOther(self, token): argument
1952 return token
1989 def processSpaceCharacters(self, token): argument
1990 return self.parser.phases["inTable"].processSpaceCharacters(token)
1992 def processCharacters(self, token): argument
1993 return self.parser.phases["inTable"].processCharacters(token)
1995 def startTagTr(self, token): argument
1997 self.tree.insertElement(token)
2000 def startTagTableCell(self, token): argument
2002 {"name": token["name"]})
2004 return token
2006 def startTagTableOther(self, token): argument
2014 return token
2020 def startTagOther(self, token): argument
2021 return self.parser.phases["inTable"].processStartTag(token)
2023 def endTagTableRowGroup(self, token): argument
2024 if self.tree.elementInScope(token["name"], variant="table"):
2030 {"name": token["name"]})
2032 def endTagTable(self, token): argument
2039 return token
2045 def endTagIgnore(self, token): argument
2047 {"name": token["name"]})
2049 def endTagOther(self, token): argument
2050 return self.parser.phases["inTable"].processEndTag(token)
2087 def processSpaceCharacters(self, token): argument
2088 return self.parser.phases["inTable"].processSpaceCharacters(token)
2090 def processCharacters(self, token): argument
2091 return self.parser.phases["inTable"].processCharacters(token)
2093 def startTagTableCell(self, token): argument
2095 self.tree.insertElement(token)
2099 def startTagTableOther(self, token): argument
2104 return token
2106 def startTagOther(self, token): argument
2107 return self.parser.phases["inTable"].processStartTag(token)
2109 def endTagTr(self, token): argument
2119 def endTagTable(self, token): argument
2125 return token
2127 def endTagTableRowGroup(self, token): argument
2128 if self.tree.elementInScope(token["name"], variant="table"):
2130 return token
2134 def endTagIgnore(self, token): argument
2136 {"name": token["name"]})
2138 def endTagOther(self, token): argument
2139 return self.parser.phases["inTable"].processEndTag(token)
2170 def processCharacters(self, token): argument
2171 return self.parser.phases["inBody"].processCharacters(token)
2173 def startTagTableOther(self, token): argument
2177 return token
2183 def startTagOther(self, token): argument
2184 return self.parser.phases["inBody"].processStartTag(token)
2186 def endTagTableCell(self, token): argument
2187 if self.tree.elementInScope(token["name"], variant="table"):
2188 self.tree.generateImpliedEndTags(token["name"])
2189 if self.tree.openElements[-1].name != token["name"]:
2191 {"name": token["name"]})
2194 if node.name == token["name"]:
2201 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
2203 def endTagIgnore(self, token): argument
2204 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
2206 def endTagImply(self, token): argument
2207 if self.tree.elementInScope(token["name"], variant="table"):
2209 return token
2214 def endTagOther(self, token): argument
2215 return self.parser.phases["inBody"].processEndTag(token)
2245 def processCharacters(self, token): argument
2246 if token["data"] == "\u0000":
2248 self.tree.insertText(token["data"])
2250 def startTagOption(self, token): argument
2254 self.tree.insertElement(token)
2256 def startTagOptgroup(self, token): argument
2261 self.tree.insertElement(token)
2263 def startTagSelect(self, token): argument
2267 def startTagInput(self, token): argument
2271 return token
2275 def startTagScript(self, token): argument
2276 return self.parser.phases["inHead"].processStartTag(token)
2278 def startTagOther(self, token): argument
2280 {"name": token["name"]})
2282 def endTagOption(self, token): argument
2289 def endTagOptgroup(self, token): argument
2302 def endTagSelect(self, token): argument
2313 def endTagOther(self, token): argument
2315 {"name": token["name"]})
2336 def processCharacters(self, token): argument
2337 return self.parser.phases["inSelect"].processCharacters(token)
2339 def startTagTable(self, token): argument
2340 …parser.parseError("unexpected-table-element-start-tag-in-select-in-table", {"name": token["name"]})
2342 return token
2344 def startTagOther(self, token): argument
2345 return self.parser.phases["inSelect"].processStartTag(token)
2347 def endTagTable(self, token): argument
2348 …f.parser.parseError("unexpected-table-element-end-tag-in-select-in-table", {"name": token["name"]})
2349 if self.tree.elementInScope(token["name"], variant="table"):
2351 return token
2353 def endTagOther(self, token): argument
2354 return self.parser.phases["inSelect"].processEndTag(token)
2369 def adjustSVGTagNames(self, token): argument
2407 if token["name"] in replacements:
2408 token["name"] = replacements[token["name"]]
2410 def processCharacters(self, token): argument
2411 if token["data"] == "\u0000":
2412 token["data"] = "\uFFFD"
2414 any(char not in spaceCharacters for char in token["data"])):
2416 Phase.processCharacters(self, token)
2418 def processStartTag(self, token): argument
2420 if (token["name"] in self.breakoutElements or
2421 (token["name"] == "font" and
2422 set(token["data"].keys()) & set(["color", "face", "size"]))):
2424 {"name": token["name"]})
2430 return token
2434 self.parser.adjustMathMLAttributes(token)
2436 self.adjustSVGTagNames(token)
2437 self.parser.adjustSVGAttributes(token)
2438 self.parser.adjustForeignAttributes(token)
2439 token["namespace"] = currentNode.namespace
2440 self.tree.insertElement(token)
2441 if token["selfClosing"]:
2443 token["selfClosingAcknowledged"] = True
2445 def processEndTag(self, token): argument
2448 if node.name != token["name"]:
2449 self.parser.parseError("unexpected-end-tag", {"name": token["name"]})
2452 if node.name.translate(asciiUpper2Lower) == token["name"]:
2467 new_token = self.parser.phase.processEndTag(token)
2487 def processComment(self, token): argument
2490 self.tree.insertComment(token, self.tree.openElements[0])
2492 def processCharacters(self, token): argument
2495 return token
2497 def startTagHtml(self, token): argument
2498 return self.parser.phases["inBody"].processStartTag(token)
2500 def startTagOther(self, token): argument
2502 {"name": token["name"]})
2504 return token
2512 def endTagOther(self, token): argument
2514 {"name": token["name"]})
2516 return token
2542 def processCharacters(self, token): argument
2545 def startTagFrameset(self, token): argument
2546 self.tree.insertElement(token)
2548 def startTagFrame(self, token): argument
2549 self.tree.insertElement(token)
2552 def startTagNoframes(self, token): argument
2553 return self.parser.phases["inBody"].processStartTag(token)
2555 def startTagOther(self, token): argument
2557 {"name": token["name"]})
2559 def endTagFrameset(self, token): argument
2571 def endTagOther(self, token): argument
2573 {"name": token["name"]})
2595 def processCharacters(self, token): argument
2598 def startTagNoframes(self, token): argument
2599 return self.parser.phases["inHead"].processStartTag(token)
2601 def startTagOther(self, token): argument
2603 {"name": token["name"]})
2605 def endTagHtml(self, token): argument
2608 def endTagOther(self, token): argument
2610 {"name": token["name"]})
2624 def processComment(self, token): argument
2625 self.tree.insertComment(token, self.tree.document)
2627 def processSpaceCharacters(self, token): argument
2628 return self.parser.phases["inBody"].processSpaceCharacters(token)
2630 def processCharacters(self, token): argument
2633 return token
2635 def startTagHtml(self, token): argument
2636 return self.parser.phases["inBody"].processStartTag(token)
2638 def startTagOther(self, token): argument
2640 {"name": token["name"]})
2642 return token
2644 def processEndTag(self, token): argument
2646 {"name": token["name"]})
2648 return token
2663 def processComment(self, token): argument
2664 self.tree.insertComment(token, self.tree.document)
2666 def processSpaceCharacters(self, token): argument
2667 return self.parser.phases["inBody"].processSpaceCharacters(token)
2669 def processCharacters(self, token): argument
2672 def startTagHtml(self, token): argument
2673 return self.parser.phases["inBody"].processStartTag(token)
2675 def startTagNoFrames(self, token): argument
2676 return self.parser.phases["inHead"].processStartTag(token)
2678 def startTagOther(self, token): argument
2680 {"name": token["name"]})
2682 def processEndTag(self, token): argument
2684 {"name": token["name"]})