Skip to content

Commit 4796728

Browse files
Suppression de l'échappement html automatique des variables.
1 parent be8b3cd commit 4796728

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Xport/Parser/TwigExecutor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class TwigExecutor
2424
public function __construct($functions = [])
2525
{
2626
$loader = new Twig_Loader_String();
27-
$this->twig = new Twig_Environment($loader);
27+
$this->twig = new Twig_Environment($loader, ['autoescape' => false]);
2828

2929
foreach ($functions as $name => $function) {
3030
$this->twig->addFunction(new Twig_SimpleFunction($name, $function));

tests/XportTest/Parser/TwigExecutorTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,14 @@ public function testSuccessiveParsingWithFunctions()
5050
$this->assertEquals('BAR', $twigParser->parse('{{ test("bar") }}', $scope));
5151
}
5252

53+
public function testEscape()
54+
{
55+
$scope = new Scope();
56+
$scope->bind('foo', 'l\'baré');
57+
58+
$twigExecutor = new TwigExecutor($scope->getFunctions());
59+
60+
$this->assertEquals('l\'baré', $twigExecutor->parse('{{ foo }}', $scope));
61+
}
62+
5363
}

0 commit comments

Comments
 (0)