tera v1.0.0 Release Notes
Release Date: 2019-12-07 // over 4 years ago-
๐ฅ Breaking changes
- Now requires Rust 1.34
- โ Removed error-chain errors and added rich Error enum instead
- โ Filter, Tester and Function are now traits and now take borrowed values instead of owned
- โก๏ธ Updated for 2018 edition
- Require macros import to be at the top of the files along with
extends
as it is fairly cheap and the code already only really look there. - ๐ Enforce spacing in tags at the parser, before
ifsomething
was considered ok - Pluralize filter now uses
singular
andplural
arguments instead ofsuffix
- โ Add a test for checking whether a variable is an object
- Escaping now happens before inserting the final result of an expression: no need anymore to add
| safe
everywhere, only at the last position - โ Remove
safe
argument of the urlencode filter,/
is still escaped by default - ๐ The
compile_templates!
macro has been removed
Others
- โ
Tests can now use
value is not defined
order for negation (https://github.com/Keats/tera/issues/308) - โ Add
nth
filter to get the nth value in an array - You can now use glob patterns in
Tera::new
- 0๏ธโฃ
default
filter now works on Null values - Literal numbers in template overflowing i64/f64 will now be an error instead of panicking
- ๐ Allow arrays as test arguments
- โ Add the
in
operator to check if a left operand is contained in a right one. Also supports negation asnot in
- Add
Context::from_value
to instantiate aContext
from a serde_jsonValue
- โ Add
Context::from_serialize
to instantiate aContext
from something that implSerialize
- Make tests helper fns
number_args_allowed
,value_defined
andextract_string
public - โ Add
else
clause to for loops - Filters are now evaluated when checking if/elif conditions
- ๐ Allow
{{-
and-}}
for whitespace management - โ Add
xml_escape
filter - Grave accent is no longer escaped in HTML, it is not really needed anymore
- โ Add a
builtins
default feature that gate all filters/functions requiring additional dependencies - โ Add
unique
andmap
filter - โ Add a
timezone
attribute to thedate
filter - โ Add a
get_random
function to get a random number in a range - โ Add a
get_env
function to get the value of an environment variable