github nette/latte v3.1.3
Released version 3.1.3

9 hours ago

Latte 3.1.3 brings two powerful new engine features – automatic dedentation and scoped loop variables – alongside a fresh batch of filters that make everyday template work smoother.

✨ New Features

  • Feature::Dedent – removes structural indentation from paired tag content, so your generated HTML stays clean regardless of how deeply you nest your Latte tags
  • Feature::ScopedLoopVariables – variables introduced by {foreach} now live only inside the loop body, preventing accidental leaks into the surrounding scope (supports destructuring via ListNode too)
  • |commas filter – joins array elements with , and supports a custom last-item glue (e.g. {$items|commas:' and '}a, b and c)
  • |column filter – extracts values from a single column of a multidimensional array or iterable, mirroring PHP's array_column()
  • |limit filter – a friendlier wrapper around |slice with swapped arguments: limit first, offset second, and keys preserved by default
  • |slice – now works with iterators, not just arrays and strings
  • |padLeft, |padRight – now accept int|float values in addition to strings (#408)

♻️ Code Refactoring

  • Helpers::sortBeforeAfter() – reimplemented using Kahn's algorithm for topological sorting, making extension ordering both faster and more correct
  • Engine::addDefaultExtensions() – extracted into its own method for better extensibility

Don't miss a new latte release

NewReleases is sending notifications on new releases.