API Reference
Jinja2Cpp.Jinja2Wrapper.Jinja2Environment
— TypeJinja2Environment
Type describing the context and settings of the Jinja2Template
.
For more information see the source.
Jinja2Cpp.Jinja2Wrapper.Jinja2Environment
— MethodJinja2Environment(tmpl_dir::String)
Creates a new environment object used for more flexible template customization. The tmpl_dir
parameter specifies the directory path relative to which templates will be searched (when using constructions such as {% include %}
, {% import %}
or {% extend %}
).
Jinja2Cpp.Jinja2Wrapper.Jinja2Template
— TypeJinja2Template
A type containing information about the Jinja2 template used.
Jinja2Cpp.Jinja2Wrapper.Jinja2Template
— MethodJinja2Template([tmpl_env::Jinja2Environment, ] source::String; name::String = "")
Creates a template object using a source
Jinja2 string. In addition, the environment context tmpl_env
can be passed. The optional name
is used for debugging errors.
Jinja2Cpp.Jinja2Wrapper.jinja2_render
— Functionjinja2_render(template::Jinja2Template, [, values]) -> String
Renders the provided Jinja2 template
, replacing the template's placeholders with the corresponding values from vals
.
Example
julia> tmpl = Jinja2Template("<p>Hello, {{ name }}!</p>");
julia> result = jinja2_render(tmpl, Dict("name" => "Julia"))
"<p>Hello, Julia!</p>"
You can find more examples in Manual section.
Jinja2Cpp.Jinja2Wrapper.Jinja2Error
— TypeJinja2Error <: Exception
Error thrown when Jinja2 syntax is invalid.
Fields
code::Int
: Error code.message::String
: Error message.