Skip to content

Commit

Permalink
[Plugin API] Add HTML.inner_text
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbaturin committed Oct 16, 2023
1 parent f36d6e1 commit 6cf024b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugin_api.ml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,12 @@ module Html = struct
| None -> ""
| Some node -> to_general node |> Html_utils.inner_html

let inner_text node =
match node with
| None -> ""
| Some node ->
to_general node |> Soup.texts |> String.concat " "

let strip_tags node =
match node with
| None -> ""
Expand Down Expand Up @@ -865,6 +871,7 @@ struct
"delete", V.efunc (V.option Map.html **->> V.unit) Html.delete;
"delete_element", V.efunc (V.option Map.html **->> V.unit) Html.delete;
"inner_html", V.efunc (V.option Map.html **->> V.string) Html.inner_html;
"inner_text", V.efunc (V.option Map.html **->> V.string) Html.inner_text;
"clone_content", V.efunc (V.option Map.html **->> V.option Map.html) Html.clone_content;
"clone_document", V.efunc (Map.html **->> Map.html) Html.clone_page;
"strip_tags", V.efunc (V.option Map.html **->> V.string) Html.strip_tags;
Expand Down

0 comments on commit 6cf024b

Please sign in to comment.