Dotclear

source: inc/libs/twig/CHANGELOG @ 0:54703be25dd6

Revision 0:54703be25dd6, 15.2 KB checked in by Dsls <dsls@…>, 14 years ago (diff)

2.3 branch (trunk) first checkin

Line 
1* 1.0.0 (2011-03-27)
2
3Changes:
4
5 * fixed output when using mbstring
6 * fixed duplicate call of methods when using the sandbox
7 * made the charset configurable for the escape filter
8
9* 1.0.0-RC2 (2011-02-21)
10
11Changes:
12
13 * changed the way {% set %} works when capturing (the content is now marked as safe)
14 * added support for macro name in the endmacro tag
15 * make Twig_Error compatible with PHP 5.3.0 >
16 * fixed an infinite loop on some Windows configurations
17 * fixed the "length" filter for numbers
18 * fixed Template::getAttribute() as properties in PHP are case sensitive
19 * removed coupling between Twig_Node and Twig_Template
20 * fixed the ternary operator precedence rule
21
22* 1.0.0-RC1 (2011-01-09)
23
24Backward incompatibilities:
25
26 * the "items" filter, which has been deprecated for quite a long time now, has been removed
27 * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10)
28 * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }}
29 * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }}
30 * the "for" tag does not support "joined by" anymore
31 * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off")
32 * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %})
33 * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %})
34 * removed the grammar and simple token parser (moved to the Twig Extensions repository)
35
36Changes:
37
38 * added "needs_context" option for filters and functions (the context is then passed as a first argument)
39 * added global variables support
40 * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode)
41 * added the "from" tag to import macros as functions
42 * added support for functions (a function is just syntactic sugar for a getAttribute() call)
43 * made macros callable when sandbox mode is enabled
44 * added an exception when a macro uses a reserved name
45 * the "default" filter now uses the "empty" test instead of just checking for null
46 * added the "empty" test
47
48* 0.9.10 (2010-12-16)
49
50Backward incompatibilities:
51
52 * The Escaper extension is enabled by default, which means that all displayed
53   variables are now automatically escaped. You can revert to the previous
54   behavior by removing the extension via $env->removeExtension('escaper')
55   or just set the 'autoescape' option to 'false'.
56 * removed the "without loop" attribute for the "for" tag (not needed anymore
57   as the Optimizer take care of that for most cases)
58 * arrays and hashes have now a different syntax
59     * arrays keep the same syntax with square brackets: [1, 2]
60     * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"})
61     * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1})
62 * the i18n extension is now part of the Twig Extensions repository
63
64Changes:
65
66 * added the merge filter
67 * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead
68 * fixed usage of operators as method names (like is, in, and not)
69 * changed the order of execution for node visitors
70 * fixed default() filter behavior when used with strict_variables set to on
71 * fixed filesystem loader compatibility with PHAR files
72 * enhanced error messages when an unexpected token is parsed in an expression
73 * fixed filename not being added to syntax error messages
74 * added the autoescape option to enable/disable autoescaping
75 * removed the newline after a comment (mimicks PHP behavior)
76 * added a syntax error exception when parent block is used on a template that does not extend another one
77 * made the Escaper extension enabled by default
78 * fixed sandbox extension when used with auto output escaping
79 * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved)
80 * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters)
81 * added priority to node visitors
82
83* 0.9.9 (2010-11-28)
84
85Backward incompatibilities:
86 * the self special variable has been renamed to _self
87 * the odd and even filters are now tests:
88     {{ foo|odd }} must now be written {{ foo is odd }}
89 * the "safe" filter has been renamed to "raw"
90 * in Node classes,
91        sub-nodes are now accessed via getNode() (instead of property access)
92        attributes via getAttribute() (instead of array access)
93 * the urlencode filter had been renamed to url_encode
94 * the include tag now merges the passed variables with the current context by default
95   (the old behavior is still possible by adding the "only" keyword)
96 * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime)
97 * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead)
98 * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }})
99
100Changes:
101 * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template
102 * changed trans tag to accept any variable for the plural count
103 * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements)
104 * added the ** (power) operator
105 * changed the algorithm used for parsing expressions
106 * added the spaceless tag
107 * removed trim_blocks option
108 * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar())
109 * changed all exceptions to extend Twig_Error
110 * fixed unary expressions ({{ not(1 or 0) }})
111 * fixed child templates (with an extend tag) that uses one or more imports
112 * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }})
113 * escaping has been rewritten
114 * the implementation of template inheritance has been rewritten
115   (blocks can now be called individually and still work with inheritance)
116 * fixed error handling for if tag when a syntax error occurs within a subparse process
117 * added a way to implement custom logic for resolving token parsers given a tag name
118 * fixed js escaper to be stricter (now uses a whilelist-based js escaper)
119 * added the following filers: "constant", "trans", "replace", "json_encode"
120 * added a "constant" test
121 * fixed objects with __toString() not being autoescaped
122 * fixed subscript expressions when calling __call() (methods now keep the case)
123 * added "test" feature (accessible via the "is" operator)
124 * removed the debug tag (should be done in an extension)
125 * fixed trans tag when no vars are used in plural form
126 * fixed race condition when writing template cache
127 * added the special _charset variable to reference the current charset
128 * added the special _context variable to reference the current context
129 * renamed self to _self (to avoid conflict)
130 * fixed Twig_Template::getAttribute() for protected properties
131
132* 0.9.8 (2010-06-28)
133
134Backward incompatibilities:
135 * the trans tag plural count is now attached to the plural tag:
136    old: `{% trans count %}...{% plural %}...{% endtrans %}`
137    new: `{% trans %}...{% plural count %}...{% endtrans %}`
138
139 * added a way to translate strings coming from a variable ({% trans var %})
140 * fixed trans tag when used with the Escaper extension
141 * fixed default cache umask
142 * removed Twig_Template instances from the debug tag output
143 * fixed objects with __isset() defined
144 * fixed set tag when used with a capture
145 * fixed type hinting for Twig_Environment::addFilter() method
146
147* 0.9.7 (2010-06-12)
148
149Backward incompatibilities:
150 * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %})
151 * removed the sandboxed attribute of the include tag (use the new sandbox tag instead)
152 * refactored the Node system (if you have custom nodes, you will have to update them to use the new API)
153
154 * added self as a special variable that refers to the current template (useful for importing macros from the current template)
155 * added Twig_Template instance support to the include tag
156 * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %})
157 * added a grammar sub-framework to ease the creation of custom tags
158 * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface)
159 * removed the Twig_Resource::resolveMissingFilter() method
160 * fixed the filter tag which did not apply filtering to included files
161 * added a bunch of unit tests
162 * added a bunch of phpdoc
163 * added a sandbox tag in the sandbox extension
164 * changed the date filter to support any date format supported by DateTime
165 * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default)
166 * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor
167 * changed the cache option to only accepts an explicit path to a cache directory or false
168 * added a way to add token parsers, filters, and visitors without creating an extension
169 * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface
170 * changed the generated code to match the new coding standards
171 * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }})
172 * added an exception when a child template has a non-empty body (as it is always ignored when rendering)
173
174* 0.9.6 (2010-05-12)
175
176 * fixed variables defined outside a loop and for which the value changes in a for loop
177 * fixed the test suite for PHP 5.2 and older versions of PHPUnit
178 * added support for __call() in expression resolution
179 * fixed node visiting for macros (macros are now visited by visitors as any other node)
180 * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now)
181 * added the cycle filter
182 * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII
183 * added a long-syntax for the set tag ({% set foo %}...{% endset %})
184 * unit tests are now powered by PHPUnit
185 * added support for gettext via the `i18n` extension
186 * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values
187 * added a more useful exception if an if tag is not closed properly
188 * added support for escaping strategy in the autoescape tag
189 * fixed lexer when a template has a big chunk of text between/in a block
190
191* 0.9.5 (2010-01-20)
192
193As for any new release, don't forget to remove all cached templates after
194upgrading.
195
196If you have defined custom filters, you MUST upgrade them for this release. To
197upgrade, replace "array" with "new Twig_Filter_Function", and replace the
198environment constant by the "needs_environment" option:
199
200  // before
201  'even'   => array('twig_is_even_filter', false),
202  'escape' => array('twig_escape_filter', true),
203
204  // after
205  'even'   => new Twig_Filter_Function('twig_is_even_filter'),
206  'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)),
207
208If you have created NodeTransformer classes, you will need to upgrade them to
209the new interface (please note that the interface is not yet considered
210stable).
211
212 * fixed list nodes that did not extend the Twig_NodeListInterface
213 * added the "without loop" option to the for tag (it disables the generation of the loop variable)
214 * refactored node transformers to node visitors
215 * fixed automatic-escaping for blocks
216 * added a way to specify variables to pass to an included template
217 * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules)
218 * improved the filter system to allow object methods to be used as filters
219 * changed the Array and String loaders to actually make use of the cache mechanism
220 * included the default filter function definitions in the extension class files directly (Core, Escaper)
221 * added the // operator (like the floor() PHP function)
222 * added the .. operator (as a syntactic sugar for the range filter when the step is 1)
223 * added the in operator (as a syntactic sugar for the in filter)
224 * added the following filters in the Core extension: in, range
225 * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes)
226 * enhanced some error messages to provide better feedback in case of parsing errors
227
228* 0.9.4 (2009-12-02)
229
230If you have custom loaders, you MUST upgrade them for this release: The
231Twig_Loader base class has been removed, and the Twig_LoaderInterface has also
232been changed (see the source code for more information or the documentation).
233
234 * added support for DateTime instances for the date filter
235 * fixed loop.last when the array only has one item
236 * made it possible to insert newlines in tag and variable blocks
237 * fixed a bug when a literal '\n' were present in a template text
238 * fixed bug when the filename of a template contains */
239 * refactored loaders
240
241* 0.9.3 (2009-11-11)
242
243This release is NOT backward compatible with the previous releases.
244
245  The loaders do not take the cache and autoReload arguments anymore. Instead,
246  the Twig_Environment class has two new options: cache and auto_reload.
247  Upgrading your code means changing this kind of code:
248
249      $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true);
250      $twig = new Twig_Environment($loader);
251
252  to something like this:
253
254      $loader = new Twig_Loader_Filesystem('/path/to/templates');
255      $twig = new Twig_Environment($loader, array(
256        'cache' => '/path/to/compilation_cache',
257        'auto_reload' => true,
258      ));
259
260 * deprecated the "items" filter as it is not needed anymore
261 * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader
262 * optimized template loading speed
263 * removed output when an error occurs in a template and render() is used
264 * made major speed improvements for loops (up to 300% on even the smallest loops)
265 * added properties as part of the sandbox mode
266 * added public properties support (obj.item can now be the item property on the obj object)
267 * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} )
268 * fixed bug when \ was used in HTML
269
270* 0.9.2 (2009-10-29)
271
272 * made some speed optimizations
273 * changed the cache extension to .php
274 * added a js escaping strategy
275 * added support for short block tag
276 * changed the filter tag to allow chained filters
277 * made lexer more flexible as you can now change the default delimiters
278 * added set tag
279 * changed default directory permission when cache dir does not exist (more secure)
280 * added macro support
281 * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance
282 * made Twig_Autoloader::autoload() a static method
283 * avoid writing template file if an error occurs
284 * added $ escaping when outputting raw strings
285 * enhanced some error messages to ease debugging
286 * fixed empty cache files when the template contains an error
287
288* 0.9.1 (2009-10-14)
289
290  * fixed a bug in PHP 5.2.6
291  * fixed numbers with one than one decimal
292  * added support for method calls with arguments ({{ foo.bar('a', 43) }})
293  * made small speed optimizations
294  * made minor tweaks to allow better extensibility and flexibility
295
296* 0.9.0 (2009-10-12)
297
298 * Initial release
Note: See TracBrowser for help on using the repository browser.

Sites map