Browse code

removed references to old Twig versions in the doc

Fabien Potencier authored on 31/12/2010 14:39:30
Showing 2 changed files
... ...
@@ -34,11 +34,6 @@ that looks up the templates in the ``/path/to/templates/`` folder. Different
34 34
 loaders are available and you can also write your own if you want to load
35 35
 templates from a database or other resources.
36 36
 
37
-.. caution::
38
-
39
-    Before Twig 0.9.3, the ``cache`` option did not exist, and the cache
40
-    directory was passed as a second argument of the loader.
41
-
42 37
 .. note::
43 38
 
44 39
     Notice that the second argument of the environment is an array of options.
... ...
@@ -88,32 +83,21 @@ The following options are available:
88 83
   the ``auto_reload`` option, it will be determined automatically based on the
89 84
   ``debug`` value.
90 85
 
91
-* ``strict_variables`` (new in Twig 0.9.7): If set to ``false``, Twig will
92
-  silently ignore invalid variables (variables and or attributes/methods that
93
-  do not exist) and replace them with a ``null`` value. When set to ``true``,
94
-  Twig throws an exception instead (default to ``false``).
95
-
96
-* ``autoescape`` (new in Twig 0.9.10): If set to ``true``, auto-escaping will
97
-  be enabled by default for all templates (default to ``true``).
86
+* ``strict_variables``: If set to ``false``, Twig will silently ignore invalid
87
+  variables (variables and or attributes/methods that do not exist) and
88
+  replace them with a ``null`` value. When set to ``true``, Twig throws an
89
+  exception instead (default to ``false``).
98 90
 
99
-* ``optimizations`` (new in Twig 0.9.10): A flag that indicates which
100
-  optimizations to apply (default to ``-1`` -- all optimizations are enabled;
101
-  set it to ``0`` to disable).
91
+* ``autoescape``: If set to ``true``, auto-escaping will be enabled by default
92
+  for all templates (default to ``true``).
102 93
 
103
-.. caution::
104
-
105
-    Before Twig 0.9.3, the ``cache`` and ``auto_reload`` options did not
106
-    exist. They were passed as a second and third arguments of the filesystem
107
-    loader respectively.
94
+* ``optimizations``: A flag that indicates which optimizations to apply
95
+  (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to
96
+  disable).
108 97
 
109 98
 Loaders
110 99
 -------
111 100
 
112
-.. caution::
113
-
114
-    This section describes the loaders as implemented in Twig version 0.9.4
115
-    and above.
116
-
117 101
 Loaders are responsible for loading templates from a resource such as the file
118 102
 system.
119 103
 
... ...
@@ -239,8 +223,7 @@ Twig comes bundled with the following extensions:
239 223
 * *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig
240 224
   environment, making it safe to evaluated untrusted code.
241 225
 
242
-* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation (as
243
-  of Twig 0.9.10).
226
+* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation.
244 227
 
245 228
 The core, escaper, and optimizer extensions do not need to be added to the
246 229
 Twig environment, as they are registered by default. You can disable an
... ...
@@ -351,8 +334,7 @@ You can also change the escaping mode locally by using the ``autoescape`` tag:
351 334
 
352 335
     The ``autoescape`` tag has no effect on included files.
353 336
 
354
-The escaping rules are implemented as follows (it describes the behavior of
355
-Twig 0.9.9 and above):
337
+The escaping rules are implemented as follows:
356 338
 
357 339
 * Literals (integers, booleans, arrays, ...) used in the template directly as
358 340
   variables or filter arguments are never automatically escaped:
... ...
@@ -459,8 +441,8 @@ the extension constructor::
459 441
 
460 442
     $sandbox = new Twig_Extension_Sandbox($policy, true);
461 443
 
462
-Optimizer Extension (as of Twig 0.9.10)
463
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
444
+Optimizer Extension
445
+~~~~~~~~~~~~~~~~~~~
464 446
 
465 447
 The ``optimizer`` extension optimizes the node tree before compilation::
466 448
 
... ...
@@ -89,7 +89,7 @@ If a variable or attribute does not exist you will get back a ``null`` value
89 89
    * if not, and if ``foo`` is an object, check that ``bar`` is a valid method
90 90
      (even if ``bar`` is the constructor - use ``__construct()`` instead);
91 91
    * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method;
92
-   * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method (as of Twig 0.9.9);
92
+   * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method;
93 93
    * if not, return a ``null`` value.
94 94
 
95 95
    ``foo['bar']`` on the other hand works mostly the same with the a small
... ...
@@ -107,9 +107,9 @@ If a variable or attribute does not exist you will get back a ``null`` value
107 107
 
108 108
 Twig always references the following variables:
109 109
 
110
-* ``_self``: references the current template (was ``self`` before 0.9.9);
110
+* ``_self``: references the current template;
111 111
 * ``_context``: references the current context;
112
-* ``_charset``: references the current charset (as of 0.9.9).
112
+* ``_charset``: references the current charset.
113 113
 
114 114
 Filters
115 115
 -------
... ...
@@ -347,8 +347,8 @@ following constructs do the same:
347 347
 
348 348
     {% block title page_title|title %}
349 349
 
350
-Dynamic Inheritance (as of Twig 0.9.7)
351
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
350
+Dynamic Inheritance
351
+~~~~~~~~~~~~~~~~~~~
352 352
 
353 353
 Twig supports dynamic inheritance by using a variable as the base template:
354 354
 
... ...
@@ -365,8 +365,8 @@ the parent template::
365 365
 
366 366
     $twig->display('template.twig', array('layout' => $layout));
367 367
 
368
-Conditional Inheritance (as of Twig 0.9.7)
369
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368
+Conditional Inheritance
369
+~~~~~~~~~~~~~~~~~~~~~~~
370 370
 
371 371
 As a matter of fact, the template name can be any valid expression. So, it's
372 372
 also possible to make the inheritance mechanism conditional:
... ...
@@ -485,7 +485,7 @@ provided in a variable called ``users``:
485 485
     ``Traversable`` interface.
486 486
 
487 487
 If you do need to iterate over a sequence of numbers, you can use the ``..``
488
-operator (as of Twig 0.9.5):
488
+operator:
489 489
 
490 490
 .. code-block:: jinja
491 491
 
... ...
@@ -539,7 +539,7 @@ Variable              Description
539 539
 
540 540
     The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and
541 541
     ``loop.last`` variables are only available for PHP arrays, or objects that
542
-    implement the ``Countable`` interface (as of Twig 0.9.7).
542
+    implement the ``Countable`` interface.
543 543
 
544 544
 .. note::
545 545
 
... ...
@@ -581,11 +581,6 @@ You can also access both keys and values:
581 581
       {% endfor %}
582 582
     </ul>
583 583
 
584
-.. note::
585
-
586
-    On Twig before 0.9.3, you need to use the ``items`` filter to access both
587
-    the keys and values (``{% for key, value in users|items %}``).
588
-
589 584
 If
590 585
 ~~
591 586
 
... ...
@@ -749,8 +744,7 @@ the ``set`` tag and can have multiple targets:
749 744
 
750 745
     {% set foo, bar = 'foo', 'bar' %}
751 746
 
752
-The ``set`` tag can also be used to 'capture' chunks of HTML (new in Twig
753
-0.9.6):
747
+The ``set`` tag can also be used to 'capture' chunks of HTML:
754 748
 
755 749
 .. code-block:: jinja
756 750
 
... ...
@@ -811,11 +805,6 @@ You can disable access to the context by appending the ``only`` keyword:
811 805
     {# no variable will be accessible #}
812 806
     {% include 'foo' only %}
813 807
 
814
-.. note::
815
-
816
-    The ``with`` keyword is supported as of Twig 0.9.5. The ``only`` keyword
817
-    is supported as of Twig 0.9.9.
818
-
819 808
 .. tip::
820 809
 
821 810
     When including a template created by an end user, you should consider
... ...
@@ -949,13 +938,12 @@ exist:
949 938
   writing the number down. If a dot is present the number is a float,
950 939
   otherwise an integer.
951 940
 
952
-* ``["foo", "bar"]`` (new in Twig 0.9.5): Arrays are defined by a sequence of
953
-  expressions separated by a comma (``,``) and wrapped with squared brackets
954
-  (``[]``).
941
+* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions
942
+  separated by a comma (``,``) and wrapped with squared brackets (``[]``).
955 943
 
956
-* ``{"foo": "bar"}`` (new in Twig 0.9.10): Hashes are defined by a list of keys
957
-  and values separated by a comma (``,``) and wrapped with curly braces (``{}``).
958
-  A value can be any valid expression.
944
+* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values
945
+  separated by a comma (``,``) and wrapped with curly braces (``{}``). A value
946
+  can be any valid expression.
959 947
 
960 948
 * ``true`` / ``false``: ``true`` represents the true value, ``false``
961 949
   represents the false value.
... ...
@@ -1023,8 +1011,8 @@ Comparisons
1023 1011
 The following comparison operators are supported in any expression: ``==``,
1024 1012
 ``!=``, ``<``, ``>``, ``>=``, and ``<=``.
1025 1013
 
1026
-Containment Operator (new in Twig 0.9.5)
1027
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1014
+Containment Operator
1015
+~~~~~~~~~~~~~~~~~~~~
1028 1016
 
1029 1017
 The ``in`` operator performs containment test.
1030 1018
 
... ...
@@ -1052,8 +1040,8 @@ To perform a negative test, use the ``not in`` operator:
1052 1040
     {# is equivalent to #}
1053 1041
     {% if not (1 in [1, 2, 3]) %}
1054 1042
 
1055
-Tests (new in Twig 0.9.9)
1056
-~~~~~~~~~~~~~~~~~~~~~~~~~
1043
+Tests
1044
+~~~~~
1057 1045
 
1058 1046
 The ``is`` operator performs tests. Tests can be used to test a variable against
1059 1047
 a common expression. The right operand is name of the test:
... ...
@@ -1087,8 +1075,8 @@ Other Operators
1087 1075
 The following operators are very useful but don't fit into any of the other
1088 1076
 two categories:
1089 1077
 
1090
-* ``..`` (new in Twig 0.9.5): Creates a sequence based on the operand before
1091
-  and after the operator (see the ``for`` tag for some usage examples).
1078
+* ``..``: Creates a sequence based on the operand before and after the
1079
+  operator (see the ``for`` tag for some usage examples).
1092 1080
 
1093 1081
 * ``|``: Applies a filter.
1094 1082
 
... ...
@@ -1136,8 +1124,8 @@ The ``format`` filter formats a given string by replacing the placeholders
1136 1124
 
1137 1125
     {# returns I like foo and bar. (if the foo parameter equals to the foo string) #}
1138 1126
 
1139
-``replace`` (new in Twig 0.9.9)
1140
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1127
+``replace``
1128
+~~~~~~~~~~~
1141 1129
 
1142 1130
 The ``replace`` filter formats a given string by replacing the placeholders
1143 1131
 (placeholders are free-form):
... ...
@@ -1273,8 +1261,8 @@ the last filter applied to it.
1273 1261
       {{ var|raw }} {# var won't be escaped #}
1274 1262
     {% endautoescape %}
1275 1263
 
1276
-``merge`` (new in Twig 0.9.10)
1277
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1264
+``merge``
1265
+~~~~~~~~~
1278 1266
 
1279 1267
 The ``merge`` filter merges an array or a hash with the value:
1280 1268
 
... ...
@@ -1286,8 +1274,8 @@ The ``merge`` filter merges an array or a hash with the value:
1286 1274
 
1287 1275
     {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #}
1288 1276
 
1289
-List of built-in Tests (new in Twig 0.9.9)
1277
+List of built-in Tests
1278
+----------------------
1290 1279
 
1291 1280
 ``divisibleby``
1292 1281
 ~~~~~~~~~~~~~~~