-module(html_dsl@types@html). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([body_to_string/1, is_html/1, html_to_string/1, 'div'/2, img/3, a/3, h1/2, h2/2, h3/2, h4/2, h5/2, h6/2, p/2, span/2, br/0, hr/0, body/2, force/1, html/3, component/1, header/2, footer/2, nav/2, section/2, article/2, aside/2, main/2, button/2]). -export_type([html/0, body/0]). -opaque html() :: {html, binary()} | {component, binary()} | nil. -opaque body() :: {body, binary()}. -spec body_to_string(body()) -> binary(). body_to_string(Body) -> case Body of {body, Content} -> Content end. -spec is_html(html()) -> boolean(). is_html(Html) -> case Html of {html, _} -> true; _ -> false end. -spec html_to_string(html()) -> binary(). html_to_string(Html) -> case Html of {html, Content} -> Content; {component, Content@1} -> Content@1; nil -> <<""/utf8>> end. -spec 'div'(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). 'div'(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec img( binary(), binary(), gleam@option:option(html_dsl@types@attribute:attribute()) ) -> binary(). img(Src, Alt, Attributes) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), Src@1 = html_dsl@utils@check:illegal_string_check(Src), Alt@1 = html_dsl@utils@check:illegal_string_check(Alt), <<<<<<<<<<<<">/binary, "\" alt=\""/utf8>>/binary, Alt@1/binary>>/binary, "\""/utf8>>/binary, Att_str/binary>>/binary, "/>"/utf8>>. -spec a( binary(), gleam@option:option(html_dsl@types@attribute:attribute()), binary() ) -> binary(). a(Href, Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), Href@1 = html_dsl@utils@check:illegal_string_check(Href), <<<<<<<<<<<<">/binary, "\""/utf8>>/binary, Att_str/binary>>/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec h1(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). h1(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec h2(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). h2(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec h3(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). h3(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec h4(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). h4(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec h5(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). h5(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec h6(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). h6(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec p(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). p(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, "

"/utf8>>. -spec span(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). span(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec br() -> binary(). br() -> <<"
"/utf8>>. -spec hr() -> binary(). hr() -> <<"
"/utf8>>. -spec body(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> body(). body(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), {body, <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>}. -spec force({ok, html()} | {error, binary()}) -> html(). force(Result) -> case Result of {ok, Html} -> Html; {error, S} -> gleam@io:print(S), nil end. -spec html(binary(), html_dsl@types@html@head:head(), body()) -> {ok, html()} | {error, binary()}. html(Lang, Head, Body) -> Lang@1 = html_dsl@utils@check:illegal_string_check(Lang), case html_dsl@types@html@head:resolve(Head) of {ok, Head@1} -> {ok, {html, <<<<<<<<<<">/binary, "\">"/utf8>>/binary, (case Head@1 of <<""/utf8>> -> <<""/utf8>>; _ -> Head@1 end)/binary>>/binary, (body_to_string(Body))/binary>>/binary, ""/utf8>>}}; {error, S} -> {error, <<"Error: `Head` cannot resolve -> "/utf8, S/binary>>} end. -spec component(binary()) -> html(). component(Content) -> {component, Content}. -spec header( gleam@option:option(html_dsl@types@attribute:attribute()), binary() ) -> binary(). header(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec footer( gleam@option:option(html_dsl@types@attribute:attribute()), binary() ) -> binary(). footer(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec nav(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). nav(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec section( gleam@option:option(html_dsl@types@attribute:attribute()), binary() ) -> binary(). section(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec article( gleam@option:option(html_dsl@types@attribute:attribute()), binary() ) -> binary(). article(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec aside(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). aside(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec main(gleam@option:option(html_dsl@types@attribute:attribute()), binary()) -> binary(). main(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>. -spec button( gleam@option:option(html_dsl@types@attribute:attribute()), binary() ) -> binary(). button(Attributes, Inner) -> Att_str = html_dsl@types@attribute:attribute_to_string(Attributes), <<<<<<<<">/binary, ">"/utf8>>/binary, Inner/binary>>/binary, ""/utf8>>.