-module(glentities). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([decode/1, encode/2]). -export_type([encode_mode/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -type encode_mode() :: named | hex | html_body. -file("src/glentities.gleam", 22). ?DOC(" Decode any HTML entities in the given string.\n"). -spec decode(binary()) -> binary(). decode(Text) -> glentities@decoder:decode(Text). -file("src/glentities.gleam", 27). ?DOC(" Encode characters in text as HTML entities with given encoding mode.\n"). -spec encode(binary(), encode_mode()) -> binary(). encode(Text, Mode) -> case Mode of named -> glentities@named_encoder:encode(Text); hex -> glentities@hex_encoder:encode(Text); html_body -> glentities@html_encoder:encode(Text) end.