mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 20:06:31 +00:00
added some more tests for the filename autoescape strategy
This commit is contained in:
+11
-7
@@ -94,15 +94,19 @@ The following options are available:
|
||||
replace them with a ``null`` value. When set to ``true``, Twig throws an
|
||||
exception instead (default to ``false``).
|
||||
|
||||
* ``autoescape``: If set to ``true``, auto-escaping will be enabled by default
|
||||
for all templates (default to ``true``). As of Twig 1.8, you can set the
|
||||
escaping strategy to use (``html``, ``js``, ``false`` to disable). As of Twig
|
||||
1.9, you can set the escaping strategy to use (``css``, ``url``,
|
||||
* ``autoescape``: If set to ``true``, HTML auto-escaping will be enabled by
|
||||
default for all templates (default to ``true``).
|
||||
|
||||
As of Twig 1.8, you can set the escaping strategy to use (``html``, ``js``,
|
||||
``false`` to disable).
|
||||
|
||||
As of Twig 1.9, you can set the escaping strategy to use (``css``, ``url``,
|
||||
``html_attr``, or a PHP callback that takes the template "filename" and must
|
||||
return the escaping strategy to use -- the callback cannot be a function name
|
||||
to avoid collision with built-in escaping strategies). As of Twig 1.17, the
|
||||
``filename`` escaping strategy determines the escaping strategy to use for a
|
||||
template based on the template filename extension.
|
||||
to avoid collision with built-in escaping strategies).
|
||||
|
||||
As of Twig 1.17, the ``filename`` escaping strategy determines the escaping
|
||||
strategy to use for a template based on the template filename extension.
|
||||
|
||||
* ``optimizations``: A flag that indicates which optimizations to apply
|
||||
(default to ``-1`` -- all optimizations are enabled; set it to ``0`` to
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
--TEST--
|
||||
"filename" autoescape strategy
|
||||
--TEMPLATE--
|
||||
{{ br -}}
|
||||
{{ include('index.html.twig') -}}
|
||||
{{ include('index.txt.twig') -}}
|
||||
--TEMPLATE(index.html.twig)--
|
||||
{{ br -}}
|
||||
--TEMPLATE(index.txt.twig)--
|
||||
{{ br -}}
|
||||
--DATA--
|
||||
return array('br' => '<br />')
|
||||
--CONFIG--
|
||||
return array('autoescape' => 'filename')
|
||||
--EXPECT--
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
Reference in New Issue
Block a user