Packages

A DSL for generating HTML in Gleam

Current section

Files

Jump to
html_dsl src html_dsl@utils@check.erl
Raw

src/html_dsl@utils@check.erl

-module(html_dsl@utils@check).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([illegal_string_check/1]).
-spec illegal_string_check(binary()) -> binary().
illegal_string_check(Str) ->
_pipe = gleam@string:split(Str, <<""/utf8>>),
_pipe@1 = gleam@list:map(_pipe, fun(Str@1) -> case Str@1 of
<<">"/utf8>> ->
<<"&gt;"/utf8>>;
<<"<"/utf8>> ->
<<"&lt;"/utf8>>;
<<"&"/utf8>> ->
<<"&amp;"/utf8>>;
<<"\\"/utf8>> ->
<<"&#92;"/utf8>>;
<<"'"/utf8>> ->
<<"&#39;"/utf8>>;
<<"\""/utf8>> ->
<<"&#34;"/utf8>>;
_ ->
Str@1
end end),
gleam@string:join(_pipe@1, <<""/utf8>>).