Latte v2.9.1 Release Notes
Release Date: 2020-11-24 // over 4 years ago-
- Compiler: improved code indentation
- BlockMacros: added {include file with blocks} as a successor to {includeblock} (#152)
- BlockMacros: combination of n:snippet & n:ifcontent is forbidden #243
- โช Revert "{snippetArea} requires parameter" #240
- 0๏ธโฃ BlockMacros: parameters in {define} can have default values
- BlockMacros: {define} accepts named parameters #184 #198
- ๐ BlockMacros: fixed variables visibility between blocks depend on block order, alternative solution #178"
- ๐ BlockMacros: supports expression as block/snippet name
- ๐ CoreMacros: supports expression in include/extends
- {embed} can contain {import}
- Only top-level {block} is auto-closed
- SecurityPolicy: added new tags & filters
- ๐ changed \RuntimeException to Latte\RuntimeException
- ๐ changed word 'modifier' --> 'filter' in exception messages
- โช Revert "Template imported via {import} can use {extends}"
- CoreMacros: {breakIf} and {continueIf} checks ancestors instead of parents #239
- 0๏ธโฃ Defaults: filter 'webalize' is optional and depends on nette/utils #238
- CoreMacros: modified use of temporary variables
- ๐ CoreMacros: fixed {var} in {switch} usage #237
- Compiler: tag name can contain dots, dashes and colons #236
- ๐ BlockMacros: removed checks if dynamic snippet is used in {snippet} or {snippetArea} #134
For the details you can have a look at the diff.
Previous changes from v2.9.0
-
๐ New Features
- possibility to
{include block from file}
- filter
|sort
,|clamp
& custom functionclamp()
- โ added
{ifchanged}
- โ added
{skipIf}
- โ added
{foreach} {else} {/foreach}
- โ added
{try} & {else} & {rollback}
- โ added
{embed file.latte}
- โ added local blocks
{block local name}
&{define local name}
{case 1, 2, 3}
accepts more than one option- syntax
{include block foo}
and{include file foo}
- syntax
{ifset block foo}
- syntax
{ifset #$blockName}
- โ added
$iterator->parent
, returns the iterator surrounding the current one - โ added
$iterator->counter0
, returns 0-indexed counter - ๐ implemented support for named arguments
- โ added null-coalescing-safe operator
??->
๐ Improvements & Fixes
- template code: direct HTML changed to 'echo' statements
- ๐ BlockMacros: fixed variables visibility between blocks depend on block order [Closes #178]
- FilterExecutor::filterContent() converts HtmlStringable to text [Closes #215]
- ๐ Compiler: supports uppercases AND|OR|XOR [Closes #172]
- ๐จ BlockMacros: big refactoring
- ๐ Template & BlockMacros: used new class Block, removed $blockQueue & $blockTypes
- ๐ Template: removed old accumulator $_b (deprecated in 2.4, BC break)
- โ added Defaults: default filters list moved here from FilterExecutor
- CoreMacros: replaced global queuened temporary variables with local ones
- BlockMacros: snippet driver wrapped in try ... finally
- Parser: fixed parsing {__()} [Closes #226]
- checks for valid macro/filter/function/block names
- macros validates arguments, modifiers, position (MacroNode::validate())
- {debugbreak} uses only xdebug
- ๐ changed word 'macro' --> 'tag' in exception messages
- CachingIterator: do not ask when not in valid state (#230)
- ๐ improved typehints
- PhpHelpers::reformatCode() appends correctly semicolon after '${""}'
๐ Changes
- ๐ Colons as argument separators in modifiers are deprecated (BC break)
- optional chaining: operator ?-> in Latte behaves the same as in PHP (BC break)
- ๐ optional chaining: deprecated support for $var? and $obj?::$prop to be consistent with PHP 8 (BC break)
- internal variables are prefixed $__ and disallowed to be used
- Template: changed $contentType and $blocks to constants CONTENT_TYPE & BLOCKS
- ๐ Template & BlockMacros: moved snippets to own layer, removed '_' prefix
- possibility to