Skip to content

Commit c98e01d

Browse files
committed
Update documentation
1 parent 0a01bed commit c98e01d

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

docs/examples.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ There are 3 ways to create or parse objects in Selectolax:
1414

1515
1. Parse HTML as a full document using ``LexborHTMLParser()``
1616
2. Parse HTML as a fragment using ``LexborHTMLParser(..., is_fragment=True)``
17-
3. Create single node using ``LexborHTMLParser().create_tag()``
17+
3. Create single node using ``LexborHTMLParser(...).create_node()``
1818

1919
- ``LexborHTMLParser()`` - Returns the HTML tree as parsed by Lexbor, unmodified. The HTML is assumed to be a full document. ``<html>``, ``<head>``, and ``<body>`` tags are added if missing.
2020

@@ -23,7 +23,6 @@ There are 3 ways to create or parse objects in Selectolax:
2323
Drops ``<html>``, ``<head>``, and ``<body>`` tags if present in the input HTML.
2424
Use it to parse snippets of HTML that are not complete documents.
2525

26-
- ``create_tag()`` - Create a single empty node for given tag.
2726

2827
.. code-block:: python
2928
@@ -55,13 +54,13 @@ There are 3 ways to create or parse objects in Selectolax:
5554
"""
5655
5756
# Parse HTML as a full document
58-
html_tree = LexborHTMLParser(html)
57+
parser = LexborHTMLParser(html)
5958
6059
# Parse HTML as a fragment
61-
frag_tree = LexborHTMLParser(html, is_fragment=True)
60+
frag_parser = LexborHTMLParser(html, is_fragment=True)
6261
63-
# Create a single node
64-
node = LexborHTMLParser().create_tag("div")
62+
# Create a new node for `parser`.
63+
node = parser.create_node("div")
6564
6665
CSS Selectors
6766
-------------
@@ -458,7 +457,7 @@ Insert new content into the DOM at specific positions.
458457
green_node.insert_before(subtree)
459458
460459
# Insert before, after, or as child
461-
car_div = LexborHTMLParser().create_tag("div")
460+
car_div = parser.create_node("div")
462461
car_div.inner_html = "Car"
463462
green_node.insert_before(car_div)
464463
green_node.insert_after(car_div)

0 commit comments

Comments
 (0)