-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add parse_fragment and create_tag (#134)
* feat: add parse_fragment and create_tag * refactor: markdown stylign * refactor: elaborate docs * refactor: remove lexbor_ prefix
- Loading branch information
1 parent
279c526
commit de807b5
Showing
9 changed files
with
381 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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, LexborHTMLParser) | ||
|
||
|
||
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, LexborHTMLParser) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.