February 8th, 2025
-
Support list and map literals. List and map literals can now be used in templates. List literals are created using square brackets and map literals are created using curly braces. For example,
[1, 2, 3]
is a list literal and{ "key": "value" }
is a map literal. -
Fix bug with filters expecting a borrowed argument would error. If a filter expected a borrowed argument, but the argument was owned, the filter code would error. This is now fixed.
February 23rd, 2024
October 28th, 2023
-
Add
with_template_fn
toRenderer
This allows you to configure the way that included templates are resolved. -
Allow setting
max_include_depth
at renderer level This allows you to configure the maximum include depth on a per-renderer basis.
July 23rd, 2023
- Add
.template(name)
function to engine This function is a shorthand forget_template
that panics if the template does not exist.
July 23rd, 2023
-
Redesign the render API This improvement allows us to add more configuration to the rendering process in the future. It also prevents the need for a proliferation of rendering functions. The new public
Renderer
struct is created using one of the three functions:render
,render_from
, orrender_from_fn
. And then the renderer can be consumed using.to_string()
or.to_writer(..)
. -
Allow values to be fetched lazily This allows you to provide the global context from an outside source during rendering.
-
Replace ValueCow::as_bool with truthiness function This change implements a truthiness function for evaluating conditionals.
None
,false
,0
integer and0.0
float, empty string, list, and map as falsy. Everything else is truthy.Contributed by @lunabunn
November 20th, 2022
- Expand supported filter argument types Adds the unit type, all
integer primitive types, and
f32
.
- Fix bug in
value!
macro - Use index implementation for looking up spans This removes all the unsafe code in this library. I think the decrease in performance (about 5-10%) is worth not having any unsafe code.
November 14th, 2022
- Add methods to remove templates and functions
remove_template
allows you to remove a template from the engine.remove_function
allows you to remove a formatter or filter from the engine.add_formatter
andadd_filter
now return the previous type of function if a function of the same name already existed in the engine. - Add some
From
andFromIterator
impls forValue
- Support and test on Rust 1.60
- Support Unicode identifiers
- Parse list indices in lexer This fixes a bug where a path like
lorem.123.ipsum
would not parse correctly because the lexer would return aToken::Number
for the span "123.ipsum". This requires adding an additional state to the lexer so that it knows when it is lexing a path versus a float literal. - Refactor formatter and filter errors Move formatter types to new
module, add
fmt::Error
type. Add filter error trait and kind. - Add template name to error, update error format
October 3rd, 2022
- Make various filter traits public This allows you to refer to them if you want to be generic over filters.
- Support
else if
This is simply desugared to a nestedif
statement in the parser. - Support scientific notation for float literals
- Use
Cow<str>
for map keys and template sources This allows you to store template sources computed at runtime in the engine while preserving support for templates included in the binary.
- Fix bug with include statement scopes
- Restrict maximum include depth. This prevents infinite recursion
when including templates. This can be configured using the
set_max_include_depth
method on anEngine
. - Disallow configuring syntax using empty strings We now panic if
you pass an empty string to
SyntaxBuilder
.