Permalink
Browse files

Fixes and minor additions to the docs.

  • Loading branch information...
1 parent eaadcca commit aac6cb613cf27a05d79536507f3ec3880d75b60f @javiereguiluz javiereguiluz committed Jan 31, 2013
Showing with 22 additions and 6 deletions.
  1. +17 −2 doc/api.rst
  2. +1 −1 doc/intro.rst
  3. +4 −3 doc/recipes.rst
View
@@ -312,9 +312,9 @@ Twig comes bundled with the following extensions:
to escape/unescape blocks of code.
* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig
- environment, making it safe to evaluated untrusted code.
+ environment, making it safe to evaluate untrusted code.
-* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation.
+* *Twig_Extension_Optimizer*: Optimizes the node tree before compilation.
The core, escaper, and optimizer extensions do not need to be added to the
Twig environment, as they are registered by default.
@@ -396,6 +396,7 @@ The ``core`` extension defines all the core features of Twig:
* ``date``
* ``dump``
* ``random``
+ * ``include``
* Tests:
@@ -566,6 +567,20 @@ to enable by passing them to the constructor::
$twig->addExtension($optimizer);
+Twig supports the following optimizations:
+
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL``, enables all optimizations
+(this is the default value).
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE``, disables all optimizations.
+This reduces the compilation time, but it can increase the execution time
+and the consumed memory.
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR``, optimizes the ``for`` tag by
+removing the ``loop`` variable creation whenever possible.
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER``, removes the ``raw``
+filter whenever possible.
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS``, simplifies the creation
+and access of variables in the compiled templates whenever possible.
+
Exceptions
----------
View
@@ -111,7 +111,7 @@ PHP code but only provides an optimized version of the
.. tip::
- On Windows, you can also simply download and install a `pre-build DLL`_.
+ On Windows, you can also simply download and install a `pre-built DLL`_.
Basic API Usage
---------------
View
@@ -106,9 +106,10 @@ To change the block delimiters, you need to create your own lexer object::
$twig = new Twig_Environment();
$lexer = new Twig_Lexer($twig, array(
- 'tag_comment' => array('{#', '#}'),
- 'tag_block' => array('{%', '%}'),
- 'tag_variable' => array('{{', '}}'),
+ 'tag_comment' => array('{#', '#}'),
+ 'tag_block' => array('{%', '%}'),
+ 'tag_variable' => array('{{', '}}'),
+ 'interpolation' => array('#{', '}'),
));
$twig->setLexer($lexer);

0 comments on commit aac6cb6

Please sign in to comment.