Current section
Files
Jump to
Current section
Files
src/elements.erl
-module(elements).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([element/3, element_self_closing/2, attr/2, text/1, cdata/1]).
-export_type([attribute/0, element/0]).
-type attribute() :: {attribute, binary(), binary()}.
-type element() :: {element, binary(), list(attribute()), list(element())} |
{text, binary()} |
{c_data, binary()}.
-spec element(binary(), list(attribute()), list(element())) -> element().
element(Tag, Attrs, Children) ->
{element, Tag, Attrs, Children}.
-spec element_self_closing(binary(), list(attribute())) -> element().
element_self_closing(Tag, Attrs) ->
element(Tag, Attrs, []).
-spec attr(binary(), binary()) -> attribute().
attr(Key, Value) ->
{attribute, Key, Value}.
-spec text(binary()) -> element().
text(Value) ->
{text, Value}.
-spec cdata(binary()) -> element().
cdata(Value) ->
{c_data, Value}.