Current section

Files

Jump to
nakai src nakai@node.erl
Raw

src/nakai@node.erl

-module(nakai@node).
-compile(no_auto_import).
-export([comment/1, const_component/1, component/2, doctype/1, fragment/1, none/0, text/1]).
-export_type([doctype/0, node_/0]).
-type doctype() :: {doctype, binary()}.
-type node_() :: {comment, binary()} |
{component, fun(() -> node_())} |
{element, binary(), list(nakai@html@attrs:attr()), list(node_())} |
{fragment, list(node_())} |
{leaf_element, binary(), list(nakai@html@attrs:attr())} |
none |
{text, binary()}.
-spec comment(binary()) -> node_().
comment(Content) ->
{comment, Content}.
-spec const_component(fun(() -> node_())) -> node_().
const_component(Decl) ->
{component, Decl}.
-spec component(fun((EHG) -> node_()), EHG) -> node_().
component(Decl, Props) ->
{component, fun() -> Decl(Props) end}.
-spec doctype(binary()) -> doctype().
doctype(Decl) ->
{doctype, Decl}.
-spec fragment(list(node_())) -> node_().
fragment(Children) ->
{fragment, Children}.
-spec none() -> node_().
none() ->
none.
-spec text(binary()) -> node_().
text(Content) ->
{text, Content}.