Current section
Files
Jump to
Current section
Files
src/mellie.erl
-module(mellie).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/mellie.gleam").
-export([parse/1, elements_to_string/1, element_to_string/1, to_document_string/1, element/3, text/1, attribute/2]).
-file("src/mellie.gleam", 5).
-spec parse(binary()) -> {ok, presentable_soup:element_tree()} |
{error, binary()}.
parse(Str) ->
_pipe = Str,
mellie@internal@html:parse(_pipe).
-file("src/mellie.gleam", 10).
-spec elements_to_string(list(presentable_soup:element_tree())) -> binary().
elements_to_string(El) ->
presentable_soup:elements_to_string(El).
-file("src/mellie.gleam", 14).
-spec element_to_string(presentable_soup:element_tree()) -> binary().
element_to_string(El) ->
_pipe = El,
_pipe@1 = gleam@list:wrap(_pipe),
presentable_soup:elements_to_string(_pipe@1).
-file("src/mellie.gleam", 20).
-spec to_document_string(presentable_soup:element_tree()) -> binary().
to_document_string(El) ->
<<<<"<!doctype html>"/utf8, "\n"/utf8>>/binary,
(element_to_string(El))/binary>>.
-file("src/mellie.gleam", 24).
-spec element(
binary(),
list({binary(), binary()}),
list(presentable_soup:element_tree())
) -> presentable_soup:element_tree().
element(Tag, Attributes, Children) ->
{element_node, Tag, Attributes, Children}.
-file("src/mellie.gleam", 28).
-spec text(binary()) -> presentable_soup:element_tree().
text(Text) ->
{text_node, Text}.
-file("src/mellie.gleam", 32).
-spec attribute(EJT, EJU) -> {EJT, EJU}.
attribute(Name, Value) ->
{Name, Value}.