21 lines
552 B
Cython
21 lines
552 B
Cython
include "../utils.pxi"
|
|
|
|
|
|
def create_tag(tag: str):
|
|
"""
|
|
Given an HTML tag name, e.g. `"div"`, create a single empty node for that tag,
|
|
e.g. `"<div></div>"`.
|
|
"""
|
|
return do_create_tag(tag, HTMLParser)
|
|
|
|
|
|
def parse_fragment(html: str):
|
|
"""
|
|
Given HTML, parse it into a list of Nodes, such that the nodes
|
|
correspond to the given HTML.
|
|
|
|
For contrast, HTMLParser adds `<html>`, `<head>`, and `<body>` tags
|
|
if they are missing. This function does not add these tags.
|
|
"""
|
|
return do_parse_fragment(html, HTMLParser)
|