View Source template_compiler_utils (template_compiler v3.5.0)
Misc support routines.
Summary
Functions
Return the (universal) modification time of file, 0 on enoent
Set the next "Context" variable name in cs for an enclosed block.
Set the next "Vars" variable name in cs for an enclosed block.
Convert a list or binary to an atom.
Expand escape sequences like \n and \t in a string.
Generate an unique variable name
Types
Functions
-spec file_mtime(file:filename_all()) -> calendar:datetime() | 0.
Return the (universal) modification time of file, 0 on enoent
-spec next_context_var(#cs{filename :: binary(), module :: atom(), block_owner :: undefined | block_owner(), block :: atom(), blocks :: [{atom(), erl_syntax:syntaxTree(), #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}}], runtime :: atom(), context :: term(), vars_var :: string(), context_var :: string(), context_vars :: [binary()], is_autoescape :: boolean(), enabled_debug_points :: all | map()}, #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}) -> {#cs{filename :: binary(), module :: atom(), block_owner :: undefined | block_owner(), block :: atom(), blocks :: [{atom(), erl_syntax:syntaxTree(), #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}}], runtime :: atom(), context :: term(), vars_var :: string(), context_var :: string(), context_vars :: [binary()], is_autoescape :: boolean(), enabled_debug_points :: all | map()}, #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}}.
Set the next "Context" variable name in cs for an enclosed block.
-spec next_vars_var(#cs{filename :: binary(), module :: atom(), block_owner :: undefined | block_owner(), block :: atom(), blocks :: [{atom(), erl_syntax:syntaxTree(), #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}}], runtime :: atom(), context :: term(), vars_var :: string(), context_var :: string(), context_vars :: [binary()], is_autoescape :: boolean(), enabled_debug_points :: all | map()}, #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}) -> {#cs{filename :: binary(), module :: atom(), block_owner :: undefined | block_owner(), block :: atom(), blocks :: [{atom(), erl_syntax:syntaxTree(), #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}}], runtime :: atom(), context :: term(), vars_var :: string(), context_var :: string(), context_vars :: [binary()], is_autoescape :: boolean(), enabled_debug_points :: all | map()}, #ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}}.
Set the next "Vars" variable name in cs for an enclosed block.
-spec pos({file:filename_all(), pos_integer(), pos_integer()}) -> {pos_integer(), pos_integer()}.
-spec set_pos({file:filename_all(), pos_integer(), pos_integer()}, term()) -> term().
Convert a list or binary to an atom.
Expand escape sequences like \n and \t in a string.
-spec var(#ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}) -> {#ws{nr :: integer(), custom_tags :: term(), is_forloop_var :: boolean(), is_autoid_var :: boolean(), includes :: [binary()], debug_points :: [{binary(), integer(), integer()}]}, string()}.
Generate an unique variable name