- Add
Tera::parse
for some niche use-cases
- Handle path to templates starting with "./"
- Fix loop and macro context overlaps
- Fix variables being escaped when given to
set
or as arguments to filters/macros/global fns
- Update chrono
- Fix not being able to use variables starting with
or
,and
andnot
- Fix
<=
and>=
not being recognised properly - Fix if/elif conditions falling through: only the first valid one will be rendered
- Handle NaN results in
{% set %}
instead of panicking - Allow math node on if/elif conditions & fix f64 truthiness
- Fix not being able to call global functions without arguments
- Fix multiple inheritance not rendering blocks as expected for nested blocks
- Allow filters on key/value for loop containers
- Fix bug with
{% set %}
in forloops
- Add
Send
toGlobalFn
return type
- Add global functions, see README
- Add set tag, see README
- Add get filter
- Fix bug with section filter swallowing all content after the end tag
- Allow whitespace in function args
- Fix bug with variable in loop using starting with the container name (#165)
- Allow whitespace in macros/filters params
- Update Serde to 1.0.0
- Fix date filter converting everything to UTC
- Fix panic when using filters on forloop container
- Fix bug in Windows where the glob path was not removed correctly
Tera::extend
now also copy filters and testers
- Macro rendering perf improved and general code cleanup thanks to @Peternator7
- Fix bug in parser with floats
- Make
date
filter work with string input inYYYY-MM-DD
format - Big parsing improvement (~20-40%) for projects with macros and inheritance
- Add
Tera::extend
to extend another instance of Tera - Add
Tera::full_reload
that will re-run the glob and parse all templates found. - Make
Tera::add_raw_template{s}
andTera::add_template_file{s}
part of the public API - Fix location in error message when erroring in a child template
- Remove
value_render
andvalue_one_off
, you can now userender
andone_off
for both values and context
- Speed improvements on both parsing and rendering (~20-40% faster)
- Better error message on variable lookup failure in loops
- Can now iterate on maps/struct using the
{% for key, val in my_object %}
construct
- Update chrono version
- Make variable block like
{{ "hey" }}
render correctly
- Support filter sections
- Fix path prefix trimming on Windows
Tera::add_template
->Tera::add_raw_template
Tera::add_templates
->Tera::add_raw_templates
- Performance improvement thanks to @clarcharr
- Better error message for
value_render
. Thanks to @SilverWingedSeraph for the report - Hide
add_raw_template
andadd_raw_templates
from docs, they were meant for internal use - Exported macros now use the
$crate
variable, which means you don't need to import anything from Tera to have them working - Expose AST (not covered by semver)
- Add a
Context::extend
method to merge a context object into another one
- Performance improvements thanks to @wdv4758h
- Correctly register
date
filter and make it work on a RFC3339 string as well thanks to @philwhineray
- Added
Tera::value_one_off
to parse and render a single template using a Json value as context
not
is now a Tera keyword
- Added
#![deny(missing_docs)]
to the crate - Added
Tera::one_off
to parse and render a single template - Added
not
operator in conditions to mean falsiness (equivalent to!
in Rust) - Remove specific error message when using
||
or&&
- Improved performances for parsing and rendering (~5-20%)
- Added
precision
arg toround
filter - Added
date
filter to format a timestamp to a date(time) string
A few breaking changes in this one
- Tera no longer panics when parsing templates, it returns an error instead
- Tester fn signature changes from
fn(&str, Option<Value>, Vec<Value>) -> Result<bool>
tofn(Option<Value>, Vec<Value>) -> Result<bool>
- Rename
TeraResult
export toResult
- Stabilized
Tera::add_template
andTera::add_templates
- Added
compile_templates!
macro to try to compile all templates and, in case of errors, print them and exit the process - Much improved error messages
- Add a magical variable
__tera_context
that will pretty print the current context - More documentation inside the crate itself
- Actually register the
filesizeformat
,slugify
,addslashes
, good thing no one noticed - Add
divisibleby
anditerable
test - Made
try_get_value!
macro work outside of Tera
- Remove println! left behind
- Fix macros not being found in child templates
- Export
Value
andto_value
(currently from serde-json)
- Add macros
- Add
filesizeformat
filter - Add autoescape
- Add multiple level inheritance
- Add nested blocks
- Add
{{ super() }}
Thanks to @SergioBenitez and @yonran for the help!
- Fix regression when using variables in forloops + add test for it
- Change signature of tests functions (BREAKING CHANGE)
- Add more tests:
undefined
,odd
,even
,number
andstring
- Add
include
directive to include another file - Indexed array/tuple access using the
.x
wherex
is an integer
Thanks to @SergioBenitez and @andrelmartins for the contributions!
- Added filters, see README for current list
- Added tests, only
defined
for now
Thanks to @SergioBenitez, @orhanbalci, @foophoof and @Peternator7 for the contribution!
- Completely new parser
- Expose TeraError