mellie

Types

Values

pub fn attribute(name: a, value: b) -> #(a, b)
pub fn attrs(
  tree: presentable_soup.ElementTree,
) -> List(presentable_soup.ElementTree)

Gets attributes of the given element. TextNodes will return []

pub fn children(
  tree: presentable_soup.ElementTree,
) -> List(presentable_soup.ElementTree)

Gets the children of an element. TextNodes will return []

pub fn element(
  tag: String,
  attributes: List(#(String, String)),
  children: List(presentable_soup.ElementTree),
) -> presentable_soup.ElementTree
pub fn element_to_string(
  el: presentable_soup.ElementTree,
) -> String
pub fn elements_to_string(
  el: List(presentable_soup.ElementTree),
) -> String
pub fn find_all(
  from in: a,
  with fun: fn(a) -> List(a),
) -> List(a)

Runs the given function recursively over the result until it no longer results in items. Returns the found nodes from every level

pub fn find_leaf(
  from in: a,
  with fun: fn(a) -> List(a),
) -> List(a)

Runs the given function recursively over the result until it no longer returns items. Returns only the deepest matching nodes

pub fn get_child_by_tag(
  tree: presentable_soup.ElementTree,
  tag: String,
) -> Result(presentable_soup.ElementTree, Nil)
pub fn get_children_by_tag(
  tree: presentable_soup.ElementTree,
  tag: String,
) -> List(presentable_soup.ElementTree)

Gets children with the given tag up to one level of results. Use with find_all to recurse further into returned elements

pub fn inner_text(el: presentable_soup.ElementTree) -> String

Recursively get all text from given element

pub fn parse(
  html str: String,
) -> Result(presentable_soup.ElementTree, String)
pub fn tag(
  tree: presentable_soup.ElementTree,
) -> option.Option(String)

Gets tag of the given element. TextNodes will return None

pub fn text(text: String) -> presentable_soup.ElementTree
pub fn to_document_string(
  el: presentable_soup.ElementTree,
) -> String
Search Document