diff --git a/src/Bridges/ApplicationLatte/UIMacros.php b/src/Bridges/ApplicationLatte/UIMacros.php index dbdbe7960..139b77df0 100644 --- a/src/Bridges/ApplicationLatte/UIMacros.php +++ b/src/Bridges/ApplicationLatte/UIMacros.php @@ -81,11 +81,13 @@ public function finalize() */ public function macroControl(MacroNode $node, PhpWriter $writer) { + if ($node->context !== [Latte\Compiler::CONTENT_HTML, Latte\Compiler::CONTEXT_HTML_TEXT]) { + $tmp = Latte\Helpers::removeFilter($node->modifiers, 'noescape') ? '' : '|escape'; + } if ($node->modifiers) { trigger_error('Modifiers are deprecated in ' . $node->getNotation(), E_USER_DEPRECATED); - } elseif ($node->context !== [Latte\Compiler::CONTENT_HTML, Latte\Compiler::CONTEXT_HTML_TEXT]) { - $node->modifiers .= '|escape'; } + $node->modifiers .= $tmp ?? ''; $words = $node->tokenizer->fetchWords(); if (!$words) { diff --git a/tests/Bridges.Latte/UIMacros.control.3.phpt b/tests/Bridges.Latte/UIMacros.control.3.phpt index ac290052f..5785b2eeb 100644 --- a/tests/Bridges.Latte/UIMacros.control.3.phpt +++ b/tests/Bridges.Latte/UIMacros.control.3.phpt @@ -33,6 +33,11 @@ Assert::exception(function () use ($latte) { $latte->renderToString('
&', + $latte->renderToString('
', $latte->renderToString('
')