ratchet v0.2.0 Ratchet.Data

Summary

Functions

Extract attributes from a data property

Extract content from a data property

Functions

attributes(arg1, elem_attrs)

Extract attributes from a data property

iex> Data.attributes({"", href: "https://google.com", rel: "nofollow"}, [])
{:safe, ~S(href="https://google.com" rel="nofollow")}
iex> Data.attributes("lolwat", [{"data-prop", "joke"}])
{:safe, ~S(data-prop="joke")}
content(text)

Extract content from a data property

iex> Data.content("text")
"text"
iex> Data.content({"text", []})
"text"