Home Explore Blog CI



tera

3rd chunk of `CHANGELOG.md`
ef4924683f06fbc7bcf3121fda26758922c54e0c10f7e99b0000000100000fe5
- 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

## 0.11.20 (2018-11-14)

- Fix bugs in `filter` and `get` filters

## 0.11.19 (2018-10-31)

- Allow function calls in math expressions
- Allow string concatenation to start with a number
- Allow function calls in string concatenations
- Add a `concat` filter to concat arrays or push an element to an array

## 0.11.18 (2018-10-16)

- Allow concatenation of strings and numbers

## 0.11.17 (2018-10-09)

- Clear local context on each forloop iteration
- Fix variable lookup with `.` that was completely wrong
- Now requires Rust 1.26 because of some dependencies update

## 0.11.16 (2018-09-12)

- Fix `set`/`set_global` not working correctly in macros
- Deprecate `register_global_function` for `register_function`

## 0.11.15 (2018-09-09)

- Remove invalid `unreachable!` call causing panic in some combination or for loop and specific filters
- Fix macros loading in parent templates and using them in child ones
- Fix macros loading other macros not working when called in inheritance
- Mark `Context::add` as deprecated and do not display it in the docs anymore (aka TIL the `deprecated` attribute)
- Fix `__tera_context` not getting all the available context (`set`, `forloop` etc)
- Better error message when variable indexing fails

## 0.11.14 (2018-09-02)

- Remove stray println

## 0.11.13 (2018-09-02)

- Add `as_str` filter
- Way fewer allocations and significant speedup (2-5x) for templates with large objects/loops
- Checks that all macro files are accounted for at compile time and errors if it's not the case

## 0.11.12 (2018-08-04)

- `filter` filter was not properly registered (╯°□°)╯︵ ┻━┻

## 0.11.11 (2018-08-01)

- `truncate` filter now works correctly on multichar graphemes

## 0.11.10 (2018-08-01)

- Add a `throw` global function to fail rendering from inside a template

## 0.11.9 (2018-07-16)

- Add a `matching` tester
- Register `now` global function so it is available
- Update `error-chain`

## 0.11.8 (2018-06-20)

- Add `True` and `False` as boolean values to match Python
- Allow user to define their own escape function, if you want to generate JSON for example
- Add `end` argument to the `truncate` filter to override the default ellipsis
- Add a `group_by` filter
- Add a `filter` filter
- Add the `~` operator to concatenate strings
- Add a `now` global function to get local and UTC datetimes
- Add feature to enable the `preserve_order` feature of serde_json
- Less confusing behaviour with math arithmetics

## 0.11.7 (2018-04-24)

- Add array literal instantiation from inside Tera for set, set_global, kwargs
and for loop container
- Fix panic on truncate filter

## 0.11.6 (2018-03-25)

- Add `break` and `continue` to forloops
- Fix strings delimited by single quote and backtick not removing the delimiters


## 0.11.5 (2018-03-01)

- Re-export `serde_json::Number` as well

## 0.11.4 (2018-02-28)

- Re-export `serde_json::Map` as well
- You can now access inside a variable using index notation: `{{ arr[0] }}`, `{{ arr[idx] }}` etc
thanks to @bootandy
- Add `Context::insert` identical to `Context::add` to mirror Rust HashMap/BTreeMap syntax


## 0.11.3 (2018-02-15)

- Add a `slice` filter for arrays
- Fix macro files importing other macro files not loading properly
- Fix forloop container being allowed logic expressions
- Much improved parsing error messages

## 0.11.2 (2018-02-01)

- Fix regression when including templates that import macros
- Fix `pluralize` filter for real this time!

## 0.11.1 (2018-01-25)

- Fix regression with expressions in comparisons

## 0.11.0 (2018-01-22)

### Breaking changes

- Tests parentheses are now mandatory if there are arguments (`divisibleby 2` -> `divisibleby(2)`)
- Tests can be only used on variables now, not on expressions

Title: Tera Changelog: Versions 0.11.20 to 0.11.0
Summary
This document summarizes the changes made to the Tera templating engine, spanning from version 0.11.20 (November 14, 2018) to version 0.11.0 (January 22, 2018). The changes include the addition of new filters (e.g., `concat`, `as_str`, `group_by`, `filter`, `slice`), functions (e.g., `now`, `throw`), and testers (e.g., `matching`). It highlights bug fixes related to filters, macros, variable lookup, and for loops. New features such as allowing function calls in math expressions and string concatenation, array literal instantiation, break/continue statements in for loops, and accessing variables using index notation have been added. Breaking changes include mandatory parentheses for tests with arguments and restricting tests to be used only on variables.