Browse code

Fixes and minor additions to the docs.

Javier Eguiluz authored on 31/01/2013 08:30:58
Showing 3 changed files
... ...
@@ -312,9 +312,9 @@ Twig comes bundled with the following extensions:
312 312
   to escape/unescape blocks of code.
313 313
 
314 314
 * *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig
315
-  environment, making it safe to evaluated untrusted code.
315
+  environment, making it safe to evaluate untrusted code.
316 316
 
317
-* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation.
317
+* *Twig_Extension_Optimizer*: Optimizes the node tree before compilation.
318 318
 
319 319
 The core, escaper, and optimizer extensions do not need to be added to the
320 320
 Twig environment, as they are registered by default.
... ...
@@ -396,6 +396,7 @@ The ``core`` extension defines all the core features of Twig:
396 396
   * ``date``
397 397
   * ``dump``
398 398
   * ``random``
399
+  * ``include``
399 400
 
400 401
 * Tests:
401 402
 
... ...
@@ -566,6 +567,20 @@ to enable by passing them to the constructor::
566 567
 
567 568
     $twig->addExtension($optimizer);
568 569
 
570
+Twig supports the following optimizations:
571
+
572
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_ALL``, enables all optimizations
573
+(this is the default value).
574
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_NONE``, disables all optimizations.
575
+This reduces the compilation time, but it can increase the execution time
576
+and the consumed memory.
577
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR``, optimizes the ``for`` tag by
578
+removing the ``loop`` variable creation whenever possible.
579
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_RAW_FILTER``, removes the ``raw``
580
+filter whenever possible.
581
+* ``Twig_NodeVisitor_Optimizer::OPTIMIZE_VAR_ACCESS``, simplifies the creation
582
+and access of variables in the compiled templates whenever possible.
583
+
569 584
 Exceptions
570 585
 ----------
571 586
 
... ...
@@ -111,7 +111,7 @@ PHP code but only provides an optimized version of the
111 111
 
112 112
 .. tip::
113 113
 
114
-    On Windows, you can also simply download and install a `pre-build DLL`_.
114
+    On Windows, you can also simply download and install a `pre-built DLL`_.
115 115
 
116 116
 Basic API Usage
117 117
 ---------------
... ...
@@ -106,9 +106,10 @@ To change the block delimiters, you need to create your own lexer object::
106 106
     $twig = new Twig_Environment();
107 107
 
108 108
     $lexer = new Twig_Lexer($twig, array(
109
-        'tag_comment'  => array('{#', '#}'),
110
-        'tag_block'    => array('{%', '%}'),
111
-        'tag_variable' => array('{{', '}}'),
109
+        'tag_comment'   => array('{#', '#}'),
110
+        'tag_block'     => array('{%', '%}'),
111
+        'tag_variable'  => array('{{', '}}'),
112
+        'interpolation' => array('#{', '}'),
112 113
     ));
113 114
     $twig->setLexer($lexer);
114 115