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 and plural arguments instead of suffix
    • โž• 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 as not in
    • Add Context::from_value to instantiate a Context from a serde_json Value
    • โž• Add Context::from_serialize to instantiate a Context from something that impl Serialize
    • Make tests helper fns number_args_allowed, value_defined and extract_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 and map filter
    • โž• Add a timezone attribute to the date 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