Skip to content

0.11.0

Compare
Choose a tag to compare
@djc djc released this 21 Dec 22:01
· 457 commits to main since this release
5cfef32

After almost 18 months of development, I'm happy to finally announce the 0.11.0 release of Askama, the type-safe, compiled Jinja-like template engine for Rust. Importantly, during this release cycles two new members joined the Askama team (consisting of just @djc at the start of this release): @vallentin and @Kijewski, who both contributed many well-designed improvements to this release. Contributors added integrations for the Axum and Tide web frameworks to our existing set of integrations for Rocket, Actix-Web, Warp and Gotham.

Perhaps the most visible change in this release is the redefined Template trait which now has a DynTemplate counterpart rather than the SizedTemplate used in the previous release (see #579). That said, the template language itself has grown a number of helpful features (as detailed below), while the code generator can now avoid many compilation issues due to better heuristics. We also improved whitespace handling to be more correct, and made several dependencies optional such that using default-features = false on any of the Askama crates should minimize dependencies if so desired.

Changes:

  • Use a separate trait for object safety (#579)
  • Allow whitespace in expressions (#327, thanks to @cipriancraciun)
  • Add support for shadowing variables (#411)
  • Change extension values to ignore common Jinja extensions (#458)
  • Disable default features for askama_shared in askama_derive (#344, thanks to @JohnTitor)
  • Disable Askama's default features in integration crates (#409, thanks to @Randati)
  • Upgrade to nom 7 (#530; nom 6 was done in #372)
  • Improve error messages using cuts (#513)
  • Improve error messages using compile_error!() (#373, thanks to @msrd0 for improving this in #374)
  • Allow paths to start with :: (#393)
  • Improve template loop generation (#401)
  • Remove implicit borrowing of literals, calls and more (#423)
  • Pass all-uppercase variables through as constants (#433)
  • Enable no_std support in askama_escape (#436, thanks to @Nemo157)
  • Use raw identifiers for identifiers which collide with Rust keywords (#476, thanks to @SciStarter)
  • Rework implicit borrowing to be more relaxed (#396, thanks to @msrd0 for adding tests in #379)
  • Improve if-statement generation to avoid issues with implicit borrows (#392)

Bug fixes:

  • Fix whitespace issues in match blocks (#399)
  • Fix path parser to account for single identifier type names (#453)
  • Fix support for raw method identifiers (#548, thanks to @kellytk)
  • Fix code generation for macro calls that store args in variables (#499, thanks to @rfk)
  • Fix loop generation when accessing field (#500)
  • Fix whitespace handling in if-blocks (#394)
  • Fix implicit borrow of expressions (#390)
  • Avoid hanging the build due to template recursion (#539, thanks to @grv07)
  • Avoid parsing non-template attributes (#549)

Template language:

  • Implement nested tuple destructuring in let and for (#506)
  • Implement struct destructuring in let and for (#509)
  • Add support for loop.cycle() expressions (#517)
  • Add support for for-else blocks (#518)
  • Add support for break and continue blocks (#519)
  • Allow whitespace trimming in raw blocks (#546)
  • Add set alias for let blocks (#402)
  • Add support for parsing nested comments (#408)
  • Fix parsing precedence and associativity (#391, #426)

Filters:

  • Stop escaping forward slashes (#486, thanks to @alexwennerberg)
  • Fix urlencode filter to be usable for URL segments, add urlencode_path (#384, thanks to @JakubValtar)
  • Add new paragraphbreaks filter (#467, thanks to @mbuscemi)
  • Add format filter that swaps the first two arguments (#345, thanks to @couchand)
  • Add support for optional escaper argument for escape filter (#560)
  • Change info_f64 and into_isize filters to take references (#359, thanks to @yshui)
  • Update book to document all filters (#429, #432)

Integrations:

  • Removed the Iron integration (#527)
  • Add Tide integration (#347, thanks to @jbr)
  • Add Axum integration (#563, thanks to @malyn)
  • Upgrade Gotham integration to Gotham 0.7 (#557)
  • Upgrade Actix-Web integration to Actix-Web 3 (#356), with support for v4 supported on main thanks to @pashinin, @jaw-sh
  • Upgrade Warp integration to warp 0.3 (#437, thanks to @paolobarbolini)
  • Preliminary support for Rocket 0.5 (#495, thanks to @shritesh and @flo-l; unreleased for now)

Thanks go to @freddyb, @edg-l, @BafDyce, @xfix, @mkj, @robjtede, @technic, @JakeChampion, @SamJakob, @jplatte, @Restioson for their contributions, too.