Skip to content

Commit

Permalink
Merge pull request #71 from jbhoot/feat/enrich-plugin-api
Browse files Browse the repository at this point in the history
Improve the HTML node type checking API
  • Loading branch information
dmbaturin authored Sep 5, 2024
2 parents 6714700 + edc05c7 commit 9e0f008
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plugin_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ module Html = struct
| ElementNode n -> Soup.coerce n
| SoupNode n -> Soup.coerce n

let is_text n =
n |> to_general |> Soup.is_text

let to_soup n =
match n with
| SoupNode n -> n
Expand All @@ -185,9 +188,7 @@ module Html = struct
to_general n |> Soup.is_root

let is_document n =
match n with
| SoupNode _ -> true
| _ -> false
to_general n |> Soup.is_document

let select soup selector =
let* soup = soup in
Expand Down

0 comments on commit 9e0f008

Please sign in to comment.