View Source erlte (erlte v0.1.0)

Link to this section Summary

Functions

Compile the specified input with no variables and default format specifications
Compile the specified input with variables and default format specifications
Compile the specified input according to the format specification
Read the compiled template from the specified file
Write the compiled template to the specified file
Render the compiled template without replacing any variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.
Render compiled template replacing the specified variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.
Render the compiled template replacing the specified variables and return a new compiled template There is no error return case now but some maybe added in the future so for compatibility reasons you should handle a generic error case too.
Render compiled template and save the result into the specified file
Render compiled template replacing the specified variables and save the result into the specified file

Link to this section Types

-type compiled() :: #erlte_compiled{}.
-type format_specs() :: #erlte_format_specs{}.
-type node_specs() :: #erlte_node_specs{}.
-type tags_specs() :: #erlte_tags{}.
-type trim_specs() :: #erlte_trim{}.

Link to this section Functions

-spec compile(Input) -> {ok, Compiled} | {error, Error}
           when
               Input :: binary() | list() | {file, file:name_all()},
               Compiled :: erlte:compiled(),
               Error :: term().
Compile the specified input with no variables and default format specifications
Link to this function

compile(Input, Variables)

View Source
-spec compile(Input, Variables) -> {ok, Compiled} | {error, Error}
           when
               Input :: binary() | list() | {file, file:name_all()},
               Variables :: list(),
               Compiled :: erlte:compiled(),
               Error :: term().
Compile the specified input with variables and default format specifications
Link to this function

compile(Input, Variables, FormatSpecs)

View Source
-spec compile(Input, Variables, FormatSpecs) -> {ok, Compiled} | {error, Error}
           when
               Input :: binary() | list() | {file, file:name_all()},
               Variables :: list(),
               FormatSpecs :: undefined | erlte:format_specs(),
               Compiled :: erlte:compiled(),
               Error :: term().
Compile the specified input according to the format specification
Link to this function

compiled_read_file(Filename)

View Source
-spec compiled_read_file(Filename) -> {ok, Compiled} | {error, Reason}
                      when
                          Filename :: file:name_all(),
                          Compiled :: erlte:compiled(),
                          Reason :: file:posix() | badarg | terminated | system_limit.
Read the compiled template from the specified file
Link to this function

compiled_write_file(Filename, Compiled)

View Source
-spec compiled_write_file(Filename, Compiled) -> ok | {error, Reason}
                       when
                           Filename :: file:name_all(),
                           Compiled :: erlte:compiled(),
                           Reason :: file:posix() | badarg | terminated | system_limit.
Write the compiled template to the specified file
-spec render(Compiled) -> {ok, Result} | {error, Error}
          when Compiled :: erlte:compiled(), Result :: binary(), Error :: term().
Render the compiled template without replacing any variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.
Link to this function

render(Compiled, Variables)

View Source
-spec render(Compiled, Variables) -> {ok, Result} | {error, Error}
          when
              Compiled :: erlte:compiled(),
              Variables :: list(),
              Result :: binary(),
              Error :: term().
Render compiled template replacing the specified variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.
Link to this function

render_to_compiled(Compiled, Variables)

View Source
-spec render_to_compiled(Compiled, Variables) -> {ok, NewCompiled} | {error, Error}
                      when
                          Compiled :: erlte:compiled(),
                          Variables :: list(),
                          NewCompiled :: erlte:compiled(),
                          Error :: term().
Render the compiled template replacing the specified variables and return a new compiled template There is no error return case now but some maybe added in the future so for compatibility reasons you should handle a generic error case too.
Link to this function

render_to_file(Filename, Compiled)

View Source
-spec render_to_file(Filename, Compiled) -> {ok, Result} | {error, Reason}
                  when
                      Filename :: file:name_all(),
                      Compiled :: erlte:compiled(),
                      Result :: binary(),
                      Reason :: file:posix() | badarg | terminated | system_limit.
Render compiled template and save the result into the specified file
Link to this function

render_to_file(Filename, Compiled, Variables)

View Source
-spec render_to_file(Filename, Compiled, Variables) -> {ok, Result} | {error, Reason}
                  when
                      Filename :: file:name_all(),
                      Compiled :: erlte:compiled(),
                      Variables :: undefined | list(),
                      Result :: binary(),
                      Reason :: file:posix() | badarg | terminated | system_limit.
Render compiled template replacing the specified variables and save the result into the specified file