Browse code

added some more tests for the filename autoescape strategy

Fabien Potencier authored on 14/01/2015 06:56:45
Showing 2 changed files
... ...
@@ -94,15 +94,19 @@ The following options are available:
94 94
   replace them with a ``null`` value. When set to ``true``, Twig throws an
95 95
   exception instead (default to ``false``).
96 96
 
97
-* ``autoescape``: If set to ``true``, auto-escaping will be enabled by default
98
-  for all templates (default to ``true``). As of Twig 1.8, you can set the
99
-  escaping strategy to use (``html``, ``js``, ``false`` to disable). As of Twig
100
-  1.9, you can set the escaping strategy to use (``css``, ``url``,
97
+* ``autoescape``: If set to ``true``, HTML auto-escaping will be enabled by
98
+  default for all templates (default to ``true``).
99
+
100
+  As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``,
101
+  ``false`` to disable).
102
+
103
+  As of Twig 1.9, you can set the escaping strategy to use (``css``, ``url``,
101 104
   ``html_attr``, or a PHP callback that takes the template "filename" and must
102 105
   return the escaping strategy to use -- the callback cannot be a function name
103
-  to avoid collision with built-in escaping strategies). As of Twig 1.17, the
104
-  ``filename`` escaping strategy determines the escaping strategy to use for a
105
-  template based on the template filename extension.
106
+  to avoid collision with built-in escaping strategies).
107
+
108
+  As of Twig 1.17, the ``filename`` escaping strategy determines the escaping
109
+  strategy to use for a template based on the template filename extension.
106 110
 
107 111
 * ``optimizations``: A flag that indicates which optimizations to apply
108 112
   (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to
109 113
new file mode 100644
... ...
@@ -0,0 +1,18 @@
1
+--TEST--
2
+"filename" autoescape strategy
3
+--TEMPLATE--
4
+{{ br -}}
5
+{{ include('index.html.twig') -}}
6
+{{ include('index.txt.twig') -}}
7
+--TEMPLATE(index.html.twig)--
8
+{{ br -}}
9
+--TEMPLATE(index.txt.twig)--
10
+{{ br -}}
11
+--DATA--
12
+return array('br' => '<br />')
13
+--CONFIG--
14
+return array('autoescape' => 'filename')
15
+--EXPECT--
16
+&lt;br /&gt;
17
+&lt;br /&gt;
18
+<br />