Skip to content

0.7.0

Compare
Choose a tag to compare
@djc djc released this 25 Jun 13:38
· 997 commits to main since this release

I'm excited to announce a new release of Askama, the type-safe, compiled Jinja-like template engine for Rust. Among other things, this is what actix-web uses in their TechEmpower benchmarks. Note that this release relies on Rust features first released in 1.26.0.

The most interesting new feature in this release is an overhauled inheritance model:

  • _parent fields are no longer needed (but still supported for compatibility)
  • Supported for multi-layer inheritance has been implemented
  • Blocks can now be defined inside other blocks
  • The super() macro can be used to call parent blocks from inside a block
  • Removes the need for elaborate imports for inheritance across modules
  • Fixes some issues with extends paths on Windows

For this release I finally spent some time collecting benchmarks for template engines. The results can be found in this GitHub repository. I was happy to see that Askama performance seems more than competitive compared to popular alternatives.

Smaller improvements in this release:

  • Add support for Range expressions (a..b; see #95)
  • Add support for Index operation (a[b]; see #95)
  • Allow methods to be called on self
  • Add support for loop.first variable
  • Add a simple truncate filter (see #95)
  • Matching is more robust thanks to match binding modes (fixes #94)
  • askama::Error is now Send + Sync + 'static
  • Renamed lifetime on Rocket integration to prevent conflicts (fixes #88)
  • Upgrades to nom 4, syn 0.14 and quote 0.6

Thanks to @Smibu and @dathinab for contributing code to this release, and to everyone else who submitted feedback for their support in further improving Askama.

I recently started a Patreon page. If you are in a position to support ongoing maintenance and further development of Askama or use it in a for-profit context, please consider supporting my work!