Current section

Files

Jump to
nakai src gleam@html.erl
Raw

src/gleam@html.erl

-module(gleam@html).
-compile(no_auto_import).
-export([doctype/1, space/0, a/2, body/2, 'div'/2, head/2, html/2, h1/2, h2/2, h3/2, h4/2, h5/2, h6/2, img/1, li/2, link/1, ol/2, p/2, section/2, title/1, ul/2]).
-export_type([node_/0]).
-type node_() :: {comment, binary()} |
{element, binary(), list(gleam@html@attrs:attr()), list(node_())} |
{leaf_element, binary(), list(gleam@html@attrs:attr())} |
{text, binary()}.
-spec doctype(binary()) -> gleam@html@doctype:doctype().
doctype(Decl) ->
{doctype, Decl}.
-spec space() -> node_().
space() ->
{text, <<" "/utf8>>}.
-spec a(list(gleam@html@attrs:attr()), list(node_())) -> node_().
a(Attrs, Children) ->
{element, <<"a"/utf8>>, Attrs, Children}.
-spec body(list(gleam@html@attrs:attr()), list(node_())) -> node_().
body(Attrs, Children) ->
{element, <<"body"/utf8>>, Attrs, Children}.
-spec 'div'(list(gleam@html@attrs:attr()), list(node_())) -> node_().
'div'(Attrs, Children) ->
{element, <<"div"/utf8>>, Attrs, Children}.
-spec head(list(gleam@html@attrs:attr()), list(node_())) -> node_().
head(Attrs, Children) ->
{element, <<"head"/utf8>>, Attrs, Children}.
-spec html(list(gleam@html@attrs:attr()), list(node_())) -> node_().
html(Attrs, Children) ->
{element, <<"html"/utf8>>, Attrs, Children}.
-spec h1(list(gleam@html@attrs:attr()), list(node_())) -> node_().
h1(Attrs, Children) ->
{element, <<"h1"/utf8>>, Attrs, Children}.
-spec h2(list(gleam@html@attrs:attr()), list(node_())) -> node_().
h2(Attrs, Children) ->
{element, <<"h2"/utf8>>, Attrs, Children}.
-spec h3(list(gleam@html@attrs:attr()), list(node_())) -> node_().
h3(Attrs, Children) ->
{element, <<"h3"/utf8>>, Attrs, Children}.
-spec h4(list(gleam@html@attrs:attr()), list(node_())) -> node_().
h4(Attrs, Children) ->
{element, <<"h4"/utf8>>, Attrs, Children}.
-spec h5(list(gleam@html@attrs:attr()), list(node_())) -> node_().
h5(Attrs, Children) ->
{element, <<"h5"/utf8>>, Attrs, Children}.
-spec h6(list(gleam@html@attrs:attr()), list(node_())) -> node_().
h6(Attrs, Children) ->
{element, <<"h6"/utf8>>, Attrs, Children}.
-spec img(list(gleam@html@attrs:attr())) -> node_().
img(Attrs) ->
{leaf_element, <<"img"/utf8>>, Attrs}.
-spec li(list(gleam@html@attrs:attr()), list(node_())) -> node_().
li(Attrs, Children) ->
{element, <<"li"/utf8>>, Attrs, Children}.
-spec link(list(gleam@html@attrs:attr())) -> node_().
link(Attrs) ->
{leaf_element, <<"link"/utf8>>, Attrs}.
-spec ol(list(gleam@html@attrs:attr()), list(node_())) -> node_().
ol(Attrs, Children) ->
{element, <<"ol"/utf8>>, Attrs, Children}.
-spec p(list(gleam@html@attrs:attr()), list(node_())) -> node_().
p(Attrs, Children) ->
{element, <<"p"/utf8>>, Attrs, Children}.
-spec section(list(gleam@html@attrs:attr()), list(node_())) -> node_().
section(Attrs, Children) ->
{element, <<"section"/utf8>>, Attrs, Children}.
-spec title(binary()) -> node_().
title(Title) ->
{element, <<"title"/utf8>>, [], [{text, Title}]}.
-spec ul(list(gleam@html@attrs:attr()), list(node_())) -> node_().
ul(Attrs, Children) ->
{element, <<"ul"/utf8>>, Attrs, Children}.