-module(chaplin). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/chaplin.gleam"). -export([compile/1, compile_file/1, render/2, int/1, float/1, string/1, string_tree/1, object/1, list/1]). -export_type([template/0, compile_error/0, argument/0, key_type/0, render_option/0]). -type template() :: any(). -type compile_error() :: file_not_found | {incorrect_section, binary()} | invalid_delimiters | {unclosed_section, binary()} | unclosed_tag | {unsupported_tag, binary()}. -type argument() :: any(). -type key_type() :: binary. -type render_option() :: {key_type, key_type()}. -file("src/chaplin.gleam", 25). -spec compile(binary()) -> {ok, template()} | {error, compile_error()}. compile(Tmpl) -> chaplin_ffi:try_catch(fun() -> bbmustache:parse_binary(Tmpl) end). -file("src/chaplin.gleam", 29). -spec compile_file(binary()) -> {ok, template()} | {error, compile_error()}. compile_file(Path) -> chaplin_ffi:try_catch(fun() -> bbmustache:parse_file(Path) end). -file("src/chaplin.gleam", 51). -spec render(template(), list({binary(), argument()})) -> binary(). render(Template, Args) -> bbmustache:compile(Template, Args, [{key_type, binary}]). -file("src/chaplin.gleam", 56). -spec int(integer()) -> argument(). int(Of) -> chaplin_ffi:argument(Of). -file("src/chaplin.gleam", 59). -spec float(integer()) -> argument(). float(Of) -> chaplin_ffi:argument(Of). -file("src/chaplin.gleam", 62). -spec string(binary()) -> argument(). string(Of) -> chaplin_ffi:argument(Of). -file("src/chaplin.gleam", 65). -spec string_tree(gleam@string_tree:string_tree()) -> argument(). string_tree(Of) -> chaplin_ffi:argument(Of). -file("src/chaplin.gleam", 68). -spec object(list({binary(), argument()})) -> argument(). object(Of) -> chaplin_ffi:argument(Of). -file("src/chaplin.gleam", 71). -spec list(list(argument())) -> argument(). list(Of) -> chaplin_ffi:argument(Of).