Class for changing the configuration. More...
#include <inja.hpp>
Public Member Functions | |
| Environment () | |
| Environment (const std::string &global_path) | |
| Environment (const std::string &input_path, const std::string &output_path) | |
| void | set_statement (const std::string &open, const std::string &close) |
| Sets the opener and closer for template statements. | |
| void | set_line_statement (const std::string &open) |
| Sets the opener for template line statements. | |
| void | set_expression (const std::string &open, const std::string &close) |
| Sets the opener and closer for template expressions. | |
| void | set_comment (const std::string &open, const std::string &close) |
| Sets the opener and closer for template comments. | |
| void | set_trim_blocks (bool trim_blocks) |
| Sets whether to remove the first newline after a block. | |
| void | set_lstrip_blocks (bool lstrip_blocks) |
| Sets whether to strip the spaces and tabs from the start of a line to a block. | |
| void | set_search_included_templates_in_files (bool search_in_files) |
| Sets the element notation syntax. | |
| void | set_throw_at_missing_includes (bool will_throw) |
| Sets whether a missing include will throw an error. | |
| Template | parse (std::string_view input) |
| Template | parse_template (const std::string &filename) |
| Template | parse_file (const std::string &filename) |
| std::string | render (std::string_view input, const json &data) |
| std::string | render (const Template &tmpl, const json &data) |
| std::string | render_file (const std::string &filename, const json &data) |
| std::string | render_file_with_json_file (const std::string &filename, const std::string &filename_data) |
| void | write (const std::string &filename, const json &data, const std::string &filename_out) |
| void | write (const Template &temp, const json &data, const std::string &filename_out) |
| void | write_with_json_file (const std::string &filename, const std::string &filename_data, const std::string &filename_out) |
| void | write_with_json_file (const Template &temp, const std::string &filename_data, const std::string &filename_out) |
| std::ostream & | render_to (std::ostream &os, const Template &tmpl, const json &data) |
| std::string | load_file (const std::string &filename) |
| json | load_json (const std::string &filename) |
| void | add_callback (const std::string &name, const CallbackFunction &callback) |
| Adds a variadic callback. | |
| void | add_void_callback (const std::string &name, const VoidCallbackFunction &callback) |
| Adds a variadic void callback. | |
| void | add_callback (const std::string &name, int num_args, const CallbackFunction &callback) |
| Adds a callback with given number or arguments. | |
| void | add_void_callback (const std::string &name, int num_args, const VoidCallbackFunction &callback) |
| Adds a void callback with given number or arguments. | |
| void | include_template (const std::string &name, const Template &tmpl) |
| void | set_include_callback (const std::function< Template(const std::string &, const std::string &)> &callback) |
| Sets a function that is called when an included file is not found. | |
Protected Attributes | |
| std::string | input_path |
| std::string | output_path |
Private Attributes | |
| LexerConfig | lexer_config |
| ParserConfig | parser_config |
| RenderConfig | render_config |
| FunctionStorage | function_storage |
| TemplateStorage | template_storage |
|
inline |
Definition at line 2864 of file inja.hpp.
References Environment().
Referenced by inja::render().
|
inlineexplicit |
Definition at line 2868 of file inja.hpp.
References input_path, and output_path.
Referenced by Environment().
|
inline |
Definition at line 2873 of file inja.hpp.
References input_path, and output_path.
|
inline |
Adds a variadic callback.
Definition at line 3012 of file inja.hpp.
|
inline |
Adds a callback with given number or arguments.
Definition at line 3026 of file inja.hpp.
References function_storage.
|
inline |
Adds a variadic void callback.
Definition at line 3019 of file inja.hpp.
|
inline |
Adds a void callback with given number or arguments.
Definition at line 3033 of file inja.hpp.
References function_storage.
|
inline |
Includes a template with a given name into the environment. Then, a template can be rendered in another template using the include "<name>" syntax.
Definition at line 3044 of file inja.hpp.
References template_storage.
|
inline |
Definition at line 2994 of file inja.hpp.
References function_storage, input_path, lexer_config, inja::Parser::load_file(), parser_config, and template_storage.
|
inline |
Definition at line 2999 of file inja.hpp.
References inja::FileError::FileError(), and input_path.
Referenced by render_file_with_json_file(), write_with_json_file(), and write_with_json_file().
|
inline |
Definition at line 2932 of file inja.hpp.
References function_storage, input_path, lexer_config, inja::Parser::parse(), parser_config, and template_storage.
Referenced by render(), and inja::render_to().
|
inline |
Definition at line 2944 of file inja.hpp.
References parse_template().
|
inline |
Definition at line 2937 of file inja.hpp.
References function_storage, input_path, lexer_config, inja::Parser::load_file(), inja::Parser::parse_into_template(), parser_config, inja::Template::Template(), and template_storage.
Referenced by parse_file(), and render_file().
Definition at line 2952 of file inja.hpp.
|
inline |
Definition at line 2948 of file inja.hpp.
References parse().
|
inline |
Definition at line 2958 of file inja.hpp.
References parse_template().
|
inline |
Definition at line 2962 of file inja.hpp.
References load_json().
|
inline |
Definition at line 2989 of file inja.hpp.
References function_storage, render_config, and template_storage.
|
inline |
Sets the opener and closer for template comments.
Definition at line 2904 of file inja.hpp.
References inja::LexerConfig::comment_close, inja::LexerConfig::comment_close_force_rstrip, inja::LexerConfig::comment_open, inja::LexerConfig::comment_open_force_lstrip, lexer_config, and inja::LexerConfig::update_open_chars().
|
inline |
Sets the opener and closer for template expressions.
Definition at line 2895 of file inja.hpp.
References inja::LexerConfig::expression_close, inja::LexerConfig::expression_close_force_rstrip, inja::LexerConfig::expression_open, inja::LexerConfig::expression_open_force_lstrip, lexer_config, and inja::LexerConfig::update_open_chars().
|
inline |
Sets a function that is called when an included file is not found.
Definition at line 3051 of file inja.hpp.
References inja::ParserConfig::include_callback, and parser_config.
|
inline |
Sets the opener for template line statements.
Definition at line 2889 of file inja.hpp.
References lexer_config, inja::LexerConfig::line_statement, and inja::LexerConfig::update_open_chars().
|
inline |
Sets whether to strip the spaces and tabs from the start of a line to a block.
Definition at line 2918 of file inja.hpp.
References lexer_config, and inja::LexerConfig::lstrip_blocks.
|
inline |
Sets the element notation syntax.
Definition at line 2923 of file inja.hpp.
References parser_config, and inja::ParserConfig::search_included_templates_in_files.
|
inline |
Sets the opener and closer for template statements.
Definition at line 2879 of file inja.hpp.
References lexer_config, inja::LexerConfig::statement_close, inja::LexerConfig::statement_close_force_rstrip, inja::LexerConfig::statement_open, inja::LexerConfig::statement_open_force_lstrip, inja::LexerConfig::statement_open_no_lstrip, and inja::LexerConfig::update_open_chars().
|
inline |
Sets whether a missing include will throw an error.
Definition at line 2928 of file inja.hpp.
References render_config, and inja::RenderConfig::throw_at_missing_includes.
|
inline |
Sets whether to remove the first newline after a block.
Definition at line 2913 of file inja.hpp.
References lexer_config, and inja::LexerConfig::trim_blocks.
|
inline |
Definition at line 2967 of file inja.hpp.
References output_path.
|
inline |
Definition at line 2973 of file inja.hpp.
References output_path.
|
inline |
Definition at line 2979 of file inja.hpp.
References load_json().
|
inline |
|
private |
Definition at line 2856 of file inja.hpp.
Referenced by add_callback(), add_void_callback(), load_file(), parse(), parse_template(), and render_to().
|
protected |
Definition at line 2860 of file inja.hpp.
Referenced by Environment(), Environment(), load_file(), load_json(), parse(), and parse_template().
|
private |
Definition at line 2852 of file inja.hpp.
Referenced by load_file(), parse(), parse_template(), set_comment(), set_expression(), set_line_statement(), set_lstrip_blocks(), set_statement(), and set_trim_blocks().
|
protected |
Definition at line 2861 of file inja.hpp.
Referenced by Environment(), Environment(), write(), and write().
|
private |
Definition at line 2853 of file inja.hpp.
Referenced by load_file(), parse(), parse_template(), set_include_callback(), and set_search_included_templates_in_files().
|
private |
Definition at line 2854 of file inja.hpp.
Referenced by render_to(), and set_throw_at_missing_includes().
|
private |
Definition at line 2857 of file inja.hpp.
Referenced by include_template(), load_file(), parse(), parse_template(), and render_to().