def insertDoctype(self, token): name = token["name"] publicId = token["publicId"] systemId = token["systemId"] doctype = Doctype.for_name_and_ids(name, publicId, systemId) self.soup.object_was_parsed(doctype)
def test_doctype_ends_in_newline(self): # Unlike other NavigableString subclasses, a DOCTYPE always ends # in a newline. doctype = Doctype("foo") soup = self.soup("") soup.insert(1, doctype) assert soup.encode() == b"<!DOCTYPE foo>\n"
def _add_document(soup, node, soup_listing): if node.has_doctype: doctype = Doctype.for_name_and_ids(node.name, node.public_identifier, node.system_identifier) doctype.offset = node.offset soup.object_was_parsed(doctype) soup_listing.append(doctype)
def doctype(self, name, pubid, system): self.soup.endData() doctype = Doctype.for_name_and_ids(name, pubid, system) self.soup.object_was_parsed(doctype)