1 | Changelog
|
2 | =========
|
3 |
|
4 | 3.1.5 (Dec 13 2018)
|
5 | -------------------
|
6 |
|
7 | * Fix engine dependency version for Node versions > 11.1.0;
|
8 | Fixes [#1168](https://github.com/mozilla/nunjucks/issues/1168).
|
9 |
|
10 | 3.1.4 (Nov 9 2018)
|
11 | ------------------
|
12 |
|
13 | * Fix engine version for Node v11.1.0
|
14 | * Fix "Unexpected token" error for U+2028 unicode newline. Fixes [#126](https://github.com/mozilla/nunjucks/issues/126) and [#736](https://github.com/mozilla/nunjucks/issues/736)
|
15 |
|
16 | 3.1.3 (May 19 2018)
|
17 | -------------------
|
18 |
|
19 | * Add `forceescape` filter. Fixes [#782](https://github.com/mozilla/nunjucks/issues/782)
|
20 |
|
21 | * Fix regression that prevented template errors from reporting line and column number.
|
22 | Fixes [#1087](https://github.com/mozilla/nunjucks/issues/1087) and
|
23 | [#1095](https://github.com/mozilla/nunjucks/issues/1095).
|
24 |
|
25 | * Fix "Invalid type: Is" error for `{% if value is defined %}`. Fixes
|
26 | [#1110](https://github.com/mozilla/nunjucks/issues/1110)
|
27 |
|
28 | * Formally drop support for node v4 (the upgrade to babel 7 in 3.1.0 made the
|
29 | build process incompatible with node < 6.9.0).
|
30 |
|
31 | 3.1.2 (Feb 23 2018)
|
32 | -------------------
|
33 |
|
34 | * Fix regression to make `chokidar` an optional dependency again. Fixes
|
35 | [#1073](https://github.com/mozilla/nunjucks/issues/1073)
|
36 | * Fix issue when running `npm install nunjucks` with the `--no-bin-links` flag
|
37 | * Fix regression that broke template caching. Fixes
|
38 | [#1074](https://github.com/mozilla/nunjucks/issues/1074)
|
39 |
|
40 | 3.1.0 (Feb 19 2018)
|
41 | -------------------
|
42 |
|
43 | * Support nunjucks.installJinjaCompat() with slim build. Fixes
|
44 | [#1019](https://github.com/mozilla/nunjucks/issues/1019)
|
45 |
|
46 | * Fix calling render callback twice when a conditional import throws an error.
|
47 | Solves [#1029](https://github.com/mozilla/nunjucks/issues/1029)
|
48 |
|
49 | * Support objects created with Object.create(null). fixes [#468](https://github.com/mozilla/nunjucks/issues/468)
|
50 |
|
51 | * Support ESNext iterators, using Array.from. Merge of
|
52 | [#1058](https://github.com/mozilla/nunjucks/pull/1058)
|
53 |
|
54 | 3.0.1 (May 24 2017)
|
55 | -------------------
|
56 |
|
57 | * Fix handling methods and attributes of static arrays, objects and primitives.
|
58 | Solves the issue [#937](https://github.com/mozilla/nunjucks/issues/937)
|
59 |
|
60 | * Add support for python-style array slices with Jinja compat enabled.
|
61 | Fixes [#188](https://github.com/mozilla/nunjucks/issues/188); merge of
|
62 | [#976](https://github.com/mozilla/nunjucks/pull/976).
|
63 |
|
64 | * Fix call blocks having access to their parent scope. Fixes
|
65 | [#906](https://github.com/mozilla/nunjucks/issues/906); merge of
|
66 | [#994](https://github.com/mozilla/nunjucks/pull/994).
|
67 |
|
68 | * Fix a bug that caused capturing block tags (e.g. set/endset,
|
69 | filter/endfilter) to write to the global buffer rather than capturing
|
70 | their contents. Fixes
|
71 | [#914](https://github.com/mozilla/nunjucks/issues/914) and
|
72 | [#972](https://github.com/mozilla/nunjucks/issues/972); merge of
|
73 | [#990](https://github.com/mozilla/nunjucks/pull/990). Thanks [Noah
|
74 | Lange](@noahlange).
|
75 |
|
76 |
|
77 | 3.0.0 (Nov 5 2016)
|
78 | ----------------
|
79 |
|
80 | * Allow including many templates without reaching recursion limits. Merge of
|
81 | [#787](https://github.com/mozilla/nunjucks/pull/787). Thanks Gleb Khudyakov.
|
82 |
|
83 | * Allow explicitly setting `null` (aka `none`) as the value of a variable;
|
84 | don't ignore that value and look on up the frame stack or context. Fixes
|
85 | [#478](https://github.com/mozilla/nunjucks/issues/478). Thanks Jonny Gerig
|
86 | Meyer for the report.
|
87 |
|
88 | * Execute blocks in a child frame that can't write to its parent. This means
|
89 | that vars set inside blocks will not leak outside of the block, base
|
90 | templates can no longer see vars set in templates that inherit them, and
|
91 | `super()` can no longer set vars in its calling scope. Fixes the inheritance
|
92 | portion of [#561](https://github.com/mozilla/nunjucks/issues/561), which
|
93 | fully closes that issue. Thanks legutierr for the report.
|
94 |
|
95 | * Prevent macros from seeing or affecting their calling scope. Merge of
|
96 | [#667](https://github.com/mozilla/nunjucks/pull/667).
|
97 |
|
98 | * Fix handling of macro arg with default value which shares a name with another
|
99 | macro. Merge of [#791](https://github.com/mozilla/nunjucks/pull/791).
|
100 |
|
101 | * Add support for the spaces parameter in the dump template filter.
|
102 | Merge of [#868](https://github.com/mozilla/nunjucks/pull/868).
|
103 | Thanks Jesse Eikema
|
104 |
|
105 | * Add `verbatim` as an alias of `raw` for compatibility with Twig.
|
106 | Merge of [#874](https://github.com/mozilla/nunjucks/pull/874).
|
107 |
|
108 | * Add new `nl2br` filter. Thanks Marc-Aurèle Darche
|
109 |
|
110 | * Add support for python's `list.append` with Jinja compat enabled. Thanks
|
111 | Conor Flannigan.
|
112 |
|
113 | * Add variables whitespace control.
|
114 |
|
115 |
|
116 | 2.5.2 (Sep 14 2016)
|
117 | ----------------
|
118 |
|
119 | * Call `.toString` in safe filter.
|
120 | Merge of [#849](https://github.com/mozilla/nunjucks/pull/849).
|
121 |
|
122 |
|
123 | 2.5.1 (Sep 13 2016)
|
124 | ----------------
|
125 |
|
126 | * Fix `undefined` and `null` behavior in escape and safe filter.
|
127 | Merge of [#843](https://github.com/mozilla/nunjucks/pull/843).
|
128 |
|
129 |
|
130 | 2.5.0 (Sep 7 2016)
|
131 | ----------------
|
132 |
|
133 | * Add `elseif` as an alias of `elif` for parity with Twig. Thanks kswedberg.
|
134 | Merge of [#826](https://github.com/mozilla/nunjucks/pull/826).
|
135 |
|
136 | * Add nunjucks env to express app settings as `nunjucksEnv`.
|
137 | Merge of [#829](https://github.com/mozilla/nunjucks/pull/829).
|
138 |
|
139 | * Add support for finding an object's "length" in length filter.
|
140 | Merge of [#813](https://github.com/mozilla/nunjucks/pull/813).
|
141 |
|
142 | * Ensure that precompiling on Windows still outputs POSIX-style path
|
143 | separators. Merge of [#761](https://github.com/mozilla/nunjucks/pull/761).
|
144 |
|
145 | * Add support for strict type check comparisons (=== and !==). Thanks
|
146 | oughter. Merge of [#746](https://github.com/mozilla/nunjucks/pull/746).
|
147 |
|
148 | * Allow full expressions (incl. filters) in import and from tags. Thanks legutierr.
|
149 | Merge of [#710](https://github.com/mozilla/nunjucks/pull/710).
|
150 |
|
151 | * OS agnostic file paths in precompile. Merge of [#825](https://github.com/mozilla/nunjucks/pull/825).
|
152 |
|
153 |
|
154 | 2.4.3 (Sep 7 2016)
|
155 | ----------------
|
156 |
|
157 | * Fix potential cast-related XSS vulnerability in autoescape mode, and with `escape` filter.
|
158 | Thanks Matt Austin for the report and Thomas Hunkapiller for the fix.
|
159 | [#836](https://github.com/mozilla/nunjucks/pull/836)
|
160 |
|
161 |
|
162 | 2.4.2 (Apr 15 2016)
|
163 | -------------------
|
164 |
|
165 | * Fix use of `in` operator with strings. Fixes
|
166 | [#714](https://github.com/mozilla/nunjucks/issues/714). Thanks Zubrik for the
|
167 | report.
|
168 |
|
169 | * Support ES2015 Map and Set in `length` filter. Merge of
|
170 | [#705](https://github.com/mozilla/nunjucks/pull/705). Thanks ricordisamoa.
|
171 |
|
172 | * Remove truncation of long function names in error messages. Thanks Daniel
|
173 | Bendavid. Merge of [#702](https://github.com/mozilla/nunjucks/pull/702).
|
174 |
|
175 |
|
176 | 2.4.1 (Mar 17 2016)
|
177 | -------------------
|
178 |
|
179 | * Don't double-escape. Thanks legutierr. Merge of
|
180 | [#701](https://github.com/mozilla/nunjucks/pull/701).
|
181 |
|
182 | * Prevent filter.escape from escaping SafeString. Thanks atian25. Merge of
|
183 | [#623](https://github.com/mozilla/nunjucks/pull/623).
|
184 |
|
185 | * Throw an error if a block is defined multiple times. Refs
|
186 | [#696](https://github.com/mozilla/nunjucks/issues/696).
|
187 |
|
188 | * Officially recommend the `.njk` extension. Thanks David Kebler. Merge of
|
189 | [#691](https://github.com/mozilla/nunjucks/pull/691).
|
190 |
|
191 | * Allow block-set to wrap an inheritance block. Unreported; fixed as a side
|
192 | effect of the fix for [#576](https://github.com/mozilla/nunjucks/issues/576).
|
193 |
|
194 | * Fix `filter` tag with non-trivial contents. Thanks Stefan Cruz and Fabien
|
195 | Franzen for report and investigation, Jan Oopkaup for failing tests. Fixes
|
196 | [#576](https://github.com/mozilla/nunjucks/issues/576).
|
197 |
|
198 |
|
199 | 2.4.0 (Mar 10 2016)
|
200 | -------------------
|
201 |
|
202 | * Allow retrieving boolean-false as a global. Thanks Marius Büscher. Merge of
|
203 | [#694](https://github.com/mozilla/nunjucks/pull/694).
|
204 |
|
205 | * Don't automatically convert any for-loop that has an include statement into
|
206 | an async loop. Reverts
|
207 | [7d4716f4fd](https://github.com/mozilla/nunjucks/commit/7d4716f4fd), re-opens
|
208 | [#372](https://github.com/mozilla/nunjucks/issues/372), fixes
|
209 | [#527](https://github.com/mozilla/nunjucks/issues/527). Thanks Tom Delmas for
|
210 | the report.
|
211 |
|
212 | * Switch from Optimist to Yargs for argument-parsing. Thanks Bogdan
|
213 | Chadkin. Merge of [#672](https://github.com/mozilla/nunjucks/pull/672).
|
214 |
|
215 | * Prevent includes from writing to their including scope. Merge of
|
216 | [#667](https://github.com/mozilla/nunjucks/pull/667) (only partially
|
217 | backported to 2.x; macro var visibility not backported).
|
218 |
|
219 | * Fix handling of `dev` environment option, to get full tracebacks on errors
|
220 | (including nunjucks internals). Thanks Tobias Petry and Chandrasekhar Ambula
|
221 | V for the report, Aleksandr Motsjonov for draft patch.
|
222 |
|
223 | * Support using `in` operator to search in both arrays and objects,
|
224 | and it will throw an error for other data types.
|
225 | Fix [#659](https://github.com/mozilla/nunjucks/pull/659).
|
226 | Thanks Alex Mayfield for report and test, Ouyang Yadong for fix.
|
227 | Merge of [#661](https://github.com/mozilla/nunjucks/pull/661).
|
228 |
|
229 | * Add support for `{% set %}` block assignments as in jinja2. Thanks Daniele
|
230 | Rapagnani. Merge of [#656](https://github.com/mozilla/nunjucks/pull/656)
|
231 |
|
232 | * Fix `{% set %}` scoping within macros.
|
233 | Fixes [#577](https://github.com/mozilla/nunjucks/issues/577) and
|
234 | the macro portion of [#561](https://github.com/mozilla/nunjucks/issues/561).
|
235 | Thanks Ouyang Yadong. Merge of [#653](https://github.com/mozilla/nunjucks/pull/653).
|
236 |
|
237 | * Add support for named `endblock` (e.g. `{% endblock foo %}`). Thanks
|
238 | ricordisamoa. Merge of [#641](https://github.com/mozilla/nunjucks/pull/641).
|
239 |
|
240 | * Fix `range` global with zero as stop-value. Thanks Thomas Hunkapiller. Merge
|
241 | of [#638](https://github.com/mozilla/nunjucks/pull/638).
|
242 |
|
243 | * Fix a bug in urlize that collapsed whitespace. Thanks Paulo Bu. Merge of
|
244 | [#637](https://github.com/mozilla/nunjucks/pull/637).
|
245 |
|
246 | * Add `sum` filter. Thanks Pablo Matías Lazo. Merge of
|
247 | [#629](https://github.com/mozilla/nunjucks/pull/629).
|
248 |
|
249 | * Don't suppress errors inside {% if %} tags. Thanks Artemy Tregubenko for
|
250 | report and test, Ouyang Yadong for fix. Merge of
|
251 | [#634](https://github.com/mozilla/nunjucks/pull/634).
|
252 |
|
253 | * Allow whitespace control on comment blocks, too. Thanks Ouyang Yadong. Merge
|
254 | of [#632](https://github.com/mozilla/nunjucks/pull/632).
|
255 |
|
256 | * Fix whitespace control around nested tags/variables/comments. Thanks Ouyang
|
257 | Yadong. Merge of [#631](https://github.com/mozilla/nunjucks/pull/631).
|
258 |
|
259 |
|
260 | v2.3.0 (Jan 6 2016)
|
261 | -------------------
|
262 |
|
263 | * Return `null` from `WebLoader` on missing template instead of throwing an
|
264 | error, for consistency with other loaders. This allows `WebLoader` to support
|
265 | the new `ignore missing` flag on the `include` tag. If `ignore missing` is
|
266 | not set, a generic "template not found" error will still be thrown, just like
|
267 | for any other loader. Ajax errors other than 404 will still cause `WebLoader`
|
268 | to throw an error directly.
|
269 |
|
270 | * Add preserve-linebreaks option to `striptags` filter. Thanks Ivan
|
271 | Kleshnin. Merge of [#619](https://github.com/mozilla/nunjucks/pull/619).
|
272 |
|
273 |
|
274 | v2.2.0 (Nov 23 2015)
|
275 | --------------------
|
276 |
|
277 | * Add `striptags` filter. Thanks Anthony Giniers. Merge of
|
278 | [#589](https://github.com/mozilla/nunjucks/pull/589).
|
279 | * Allow compiled templates to be imported, included and extended. Thanks Luis
|
280 | Gutierrez-Sheris. Merge of
|
281 | [#581](https://github.com/mozilla/nunjucks/pull/581).
|
282 | * Fix issue with different nunjucks environments sharing same globals. Each
|
283 | environment is now independent. Thanks Paul Pechin. Merge of
|
284 | [#574](https://github.com/mozilla/nunjucks/pull/574).
|
285 | * Add negative steps support for range function. Thanks Nikita Mostovoy. Merge
|
286 | of [#575](https://github.com/mozilla/nunjucks/pull/575).
|
287 | * Remove deprecation warning when using the `default` filter without specifying
|
288 | a third argument. Merge of
|
289 | [#567](https://github.com/mozilla/nunjucks/pull/567).
|
290 | * Add support for chaining of addGlobal, addFilter, etc. Thanks Rob Graeber. Merge of
|
291 | [#537](https://github.com/mozilla/nunjucks/pull/537)
|
292 | * Fix error propagation. Thanks Tom Delmas. Merge of
|
293 | [#534](https://github.com/mozilla/nunjucks/pull/534).
|
294 | * trimBlocks now also trims windows style line endings. Thanks Magnus Tovslid. Merge of
|
295 | [#548](https://github.com/mozilla/nunjucks/pull/548)
|
296 | * `include` now supports an option to suppress errors if the template does not
|
297 | exist. Thanks Mathias Nestler. Merge of
|
298 | [#559](https://github.com/mozilla/nunjucks/pull/559)
|
299 |
|
300 |
|
301 | v2.1.0 (Sep 21 2015)
|
302 | --------------------
|
303 |
|
304 | * Fix creating `WebLoader` without `opts`. Merge of
|
305 | [#524](https://github.com/mozilla/nunjucks/pull/524).
|
306 | * Add `hasExtension` and `removeExtension` methods to `Environment`. Merge of
|
307 | [#512](https://github.com/mozilla/nunjucks/pull/512).
|
308 | * Add support for kwargs in `sort` filter. Merge of
|
309 | [#510](https://github.com/mozilla/nunjucks/pull/510).
|
310 | * Add `none` as a lexed constant evaluating to `null`. Merge of
|
311 | [#480](https://github.com/mozilla/nunjucks/pull/480).
|
312 | * Fix rendering of multiple `raw` blocks. Thanks Aaron O'Mullan. Merge of
|
313 | [#503](https://github.com/mozilla/nunjucks/pull/503).
|
314 | * Avoid crashing on async loader error. Thanks Samy Pessé. Merge of
|
315 | [#504](https://github.com/mozilla/nunjucks/pull/504).
|
316 | * Add support for keyword arguments for sort filter. Thanks Andres Pardini. Merge of
|
317 | [#510](https://github.com/mozilla/nunjucks/pull/510)
|
318 |
|
319 |
|
320 | v2.0.0 (Aug 30 2015)
|
321 | --------------------
|
322 |
|
323 | Most of the changes can be summed up in the
|
324 | [issues tagged 2.0](https://github.com/mozilla/nunjucks/issues?q=is%3Aissue+milestone%3A2.0+is%3Aclosed).
|
325 |
|
326 | Or you can
|
327 | [see all commits](https://github.com/mozilla/nunjucks/compare/v1.3.4...f8aabccefc31a9ffaccdc6797938b5187e07ea87).
|
328 |
|
329 | Most important changes:
|
330 |
|
331 | * **autoescape is now on by default.** You need to explicitly pass `{
|
332 | autoescape: false }` in the options to turn it off.
|
333 | * **watch is off by default.** You need to explicitly pass `{ watch: true }` to
|
334 | start the watcher.
|
335 | * The `default` filter has changed. It will show the default value only if the
|
336 | argument is **undefined**. Any other value, even false-y values like `false`
|
337 | and `null`, will be returned. You can get back the old behavior by passing
|
338 | `true` as a 3rd argument to activate the loose-y behavior: `foo |
|
339 | default("bar", true)`. In 2.0 if you don't pass the 3rd argument, a warning
|
340 | will be displayed about this change in behavior. In 2.1 this warning will be
|
341 | removed.
|
342 | * [New filter tag](http://mozilla.github.io/nunjucks/templating.html#filter)
|
343 | * Lots of other bug fixes and small features, view the above issue list!
|
344 |
|
345 |
|
346 | v1.3.4 (Apr 27 2015)
|
347 | --------------------
|
348 |
|
349 | This is an extremely minor release that only adds an .npmignore so that the
|
350 | bench, tests, and docs folders do not get published to npm. Nunjucks should
|
351 | download a lot faster now.
|
352 |
|
353 |
|
354 | v1.3.3 (Apr 3 2015)
|
355 | -------------------
|
356 |
|
357 | This is exactly the same as v1.3.1, just fixing a typo in the git version tag.
|
358 |
|
359 |
|
360 | v1.3.2 (Apr 3 2015)
|
361 | -------------------
|
362 |
|
363 | (no notes)
|
364 |
|
365 |
|
366 | v1.3.1 (Apr 3 2015)
|
367 | -------------------
|
368 |
|
369 | We added strict mode to all the files, but that broke running nunjucks in the
|
370 | browser. Should work now with this small fix.
|
371 |
|
372 |
|
373 | v1.3.0 (Apr 3 2015)
|
374 | -------------------
|
375 |
|
376 | * Relative templates: you can now load a template relatively by starting the
|
377 | path with ., like ./foo.html
|
378 | * FileSystemLoader now takes a noCache option, if true will disable caching
|
379 | entirely
|
380 | * Additional lstripBlocks and trimBlocks available to clean output
|
381 | automatically
|
382 | * New selectattr and rejectattr filters
|
383 | * Small fixes to the watcher
|
384 | * Several bug fixes
|
385 |
|
386 |
|
387 | v1.2.0 (Feb 4 2015)
|
388 | -------------------
|
389 |
|
390 | * The special non-line-breaking space is considered whitespace now
|
391 | * The in operator has a lower precedence now. This is potentially a breaking
|
392 | change, thus the minor version bump. See
|
393 | [#336](https://github.com/mozilla/nunjucks/pull/336)
|
394 | * import with context now implemented:
|
395 | [#319](https://github.com/mozilla/nunjucks/pull/319)
|
396 | * async rendering doesn't throw compile errors
|
397 |
|
398 |
|
399 | v1.1.0 (Sep 30 2014)
|
400 | --------------------
|
401 |
|
402 | User visible changes:
|
403 |
|
404 | * Fix a bug in urlize that would remove periods
|
405 | * custom tag syntax (like {% and %}) was made Environment-specific
|
406 | internally. Previously they were global even though you set them through the
|
407 | Environment.
|
408 | * Remove aggressive optimization that only emitted loop variables when uses. It
|
409 | introduced several bugs and didn't really improve perf.
|
410 | * Support the regular expression syntax like /foo/g.
|
411 | * The replace filter can take a regex as the first argument
|
412 | * The call tag was implemented
|
413 | * for tags can now take an else clause
|
414 | * The cycler object now exposes the current item as the current property
|
415 | * The chokidar library was updated and should fix various issues
|
416 |
|
417 | Dev changes:
|
418 |
|
419 | * Test coverage now available via istanbul. Will automatically display after
|
420 | running tests.
|
421 |
|
422 |
|
423 | v1.0.7 (Aug 15 2014)
|
424 | --------------------
|
425 |
|
426 | Mixed up a few things in the 1.0.6 release, so another small bump. This merges
|
427 | in one thing:
|
428 |
|
429 | * The length filter will not throw an error is used on an undefined
|
430 | variable. It will return 0 if the variable is undefined.
|
431 |
|
432 |
|
433 | v1.0.6 (Aug 15 2014)
|
434 | --------------------
|
435 |
|
436 | * Added the addGlobal method to the Environment object
|
437 | * import/extends/include now can take an arbitrary expression
|
438 | * fix bugs in set
|
439 | * improve express integration (allows rendering templates without an extension)
|
440 |
|
441 |
|
442 | v1.0.5 (May 1 2014)
|
443 | -------------------
|
444 |
|
445 | * Added support for browserify
|
446 | * Added option to specify template output path when precompiling templates
|
447 | * Keep version comment in browser minified files
|
448 | * Speed up SafeString implementation
|
449 | * Handle null and non-matching cases for word count filter
|
450 | * Added support for node-webkit
|
451 | * Other various minor bugfixes
|
452 |
|
453 |
|
454 | chokidar repo fix - v1.0.4 (Apr 4 2014)
|
455 | ---------------------------------------
|
456 |
|
457 | * The chokidar dependency moved repos, and though the git URL should have been
|
458 | forwarded some people were having issues. This fixed the repo and
|
459 | version.
|
460 |
|
461 | (v1.0.3 is skipped because it was published with a bad URL, quickly fixed with
|
462 | another version bump)
|
463 |
|
464 |
|
465 | Bug fixes - v1.0.2 (Mar 25 2014)
|
466 | --------------------------------
|
467 |
|
468 | * Use chokidar for watching file changes. This should fix a lot of problems on
|
469 | OS X machines.
|
470 | * Always use / in paths when precompiling templates
|
471 | * Fix bug where async filters hang indefinitely inside if statements
|
472 | * Extensions now can override autoescaping with an autoescape property
|
473 | * Other various minor bugfixes
|
474 |
|
475 |
|
476 | v1.0.1 (Dec 16, 2013)
|
477 | ---------------------
|
478 |
|
479 | (no notes)
|
480 |
|
481 |
|
482 | We've reached 1.0! Better APIs, asynchronous control, and more (Oct 24, 2013)
|
483 | -----------------------------------------------------------------------------
|
484 |
|
485 | * An asynchronous API is now available, and async filters, extensions, and
|
486 | loaders is supported. The async API is optional and if you don't do anything
|
487 | async (the default), nothing changes for you. You can read more about this
|
488 | [here](http://jlongster.github.io/nunjucks/api.html#asynchronous-support). (fixes
|
489 | [#41](https://github.com/mozilla/nunjucks/issues/41))
|
490 | * Much simpler higher-level API for initiating/configuring nunjucks is
|
491 | available. Read more
|
492 | [here](http://jlongster.github.io/nunjucks/api.html#simple-api).
|
493 | * An official grunt plugin is available for precompiling templates:
|
494 | [grunt-nunjucks](https://github.com/jlongster/grunt-nunjucks)
|
495 | * **The browser files have been renamed.** nunjucks.js is now the full library
|
496 | with compiler, and nunjucks-slim.js is the small version that only works with
|
497 | precompiled templates
|
498 | * urlencode filter has been added
|
499 | * The express integration has been refactored and isn't a kludge
|
500 | anymore. Should avoid some bugs and be more future-proof;
|
501 | * The order in which variables are lookup up in the context and frame lookup
|
502 | has been reversed. It will now look in the frame first, and then the
|
503 | context. This means that if a for loop introduces a new var, like {% for name
|
504 | in names %}, and if you have name in the context as well, it will properly
|
505 | reference name from the for loop inside the loop. (fixes
|
506 | [#122](https://github.com/mozilla/nunjucks/pull/122) and
|
507 | [#119](https://github.com/mozilla/nunjucks/issues/119))
|
508 |
|
509 |
|
510 | v0.1.10 (Aug 9 2013)
|
511 | --------------------
|
512 |
|
513 | (no notes)
|
514 |
|
515 |
|
516 | v0.1.9 (May 30 2013)
|
517 | --------------------
|
518 |
|
519 | (no notes)
|
520 |
|
521 |
|
522 | v0.1.8 - whitespace controls, unpacking, better errors, and more! (Feb 6 2013)
|
523 | ------------------------------------------------------------------------------
|
524 |
|
525 | There are lots of cool new features in this release, as well as many critical
|
526 | bug fixes.
|
527 |
|
528 | Full list of changes:
|
529 |
|
530 | * Whitespace control is implemented. Use {%- and -%} to strip whitespace before/after the block.
|
531 | * `for` loops implement Python-style array unpacking. This is a really nice
|
532 | feature which lets you do this:
|
533 |
|
534 | {% for x, y, z in [[2, 2, 2], [3, 3, 3]] %}
|
535 | --{{ x }} {{ y }} {{ z }}--
|
536 | {% endfor %}
|
537 |
|
538 | The above would output: --2 2 2----3 3 3--
|
539 |
|
540 | You can pass any number of variable names to for and it will destructure each
|
541 | array in the list to the variables.
|
542 |
|
543 | This makes the syntax between arrays and objects more
|
544 | consistent. Additionally, it allows us to implement the `dictsort` filter
|
545 | which sorts an object by keys or values. Technically, it returns an array of
|
546 | 2-value arrays and the unpacking takes care of it. Example:
|
547 |
|
548 | {% for k, v in { b: 2, a: 1 } %}
|
549 | --{{ k }}: {{ v }}--
|
550 | {% endfor %}
|
551 |
|
552 | Output: `--b: 2----a: 1--` (note: the order could actually be anything
|
553 | because it uses javascript’s `for k in obj` syntax to iterate, and ordering
|
554 | depends on the js implementation)
|
555 |
|
556 | {% for k, v in { b: 2, a: 1} | dictsort %}
|
557 | --{{ k }}: {{ v }}--
|
558 | {% endfor %}
|
559 |
|
560 | Output: `--a: 1----b: 2--`
|
561 |
|
562 | The above output will always be ordered that way. See the documentation for
|
563 | more details.
|
564 |
|
565 | Thanks to novocaine for this!
|
566 |
|
567 | * Much better error handling with at runtime (shows template/line/col information for attempting to call undefined values, etc)
|
568 | * Fixed a regression which broke the {% raw %} block
|
569 | * Fix some edge cases with variable lookups
|
570 | * Fix a regression with loading precompiled templates
|
571 | * Tweaks to allow usage with YUICompressor
|
572 | * Use the same error handling as normal when precompiling (shows proper errors)
|
573 | * Fix template loading on Windows machines
|
574 | * Fix int/float filters
|
575 | * Fix regression with super()
|
576 |
|
577 |
|
578 | v0.1.7 - helpful errors, many bug fixes (Dec 12 2012)
|
579 | -----------------------------------------------------
|
580 |
|
581 | The biggest change in v0.1.7 comes from devoidfury (thanks!) which implements
|
582 | consistent and helpful error messages. The errors are still simply raw text,
|
583 | and not pretty HTML, but they at least contain all the necessary information to
|
584 | track down an error, such as template names, line and column numbers, and the
|
585 | inheritance stack. So if an error happens in a child template, it will print
|
586 | out all the templates that it inherits. In the future, we will most likely
|
587 | display the actual line causing an error.
|
588 |
|
589 | Full list of changes:
|
590 |
|
591 | * Consistent and helpful error messages
|
592 | * Expressions are more consistent now. Previously, there were several places
|
593 | that wouldn’t accept an arbitrary expression that should. For example, you
|
594 | can now do {% include templateNames['foo'] %}, whereas previously you could
|
595 | only give it a simply variable name.
|
596 | * app.locals is fixed with express 2.5
|
597 | * Method calls on objects now have correct scope for this. Version 0.1.6 broke
|
598 | this and this was referencing the global scope.
|
599 | * A check was added to enforce loading of templates within the correct
|
600 | path. Previously you could load a file outside of the template with something
|
601 | like ../../crazyPrivateFile.txt
|
602 |
|
603 | You can
|
604 | [view all the code changes here](https://github.com/jlongster/nunjucks/compare/v0.1.6...v0.1.7). Please
|
605 | [file an issue](https://github.com/jlongster/nunjucks/issues?page=1&state=open)
|
606 | if something breaks!
|
607 |
|
608 |
|
609 | v0.1.6 - undefined handling, bugfixes (Nov 13, 2012)
|
610 | ----------------------------------------------------
|
611 |
|
612 | This is mostly a bugfix release, but there are a few small tweaks based on
|
613 | feedback:
|
614 |
|
615 | * In some cases, backslashes in the template would not appear in the
|
616 | output. This has been fixed.
|
617 | * An error is thrown if a filter is not found
|
618 | * Old versions of express are now supported (2.5.11 was tested)
|
619 | * References on undefined objects are now suppressed. For example, {{ foo }},
|
620 | {{ foo.bar }}, {{ foo.bar.baz }} all output nothing if foo is
|
621 | undefined. Previously only the first form would be suppressed, and a cryptic
|
622 | error thrown for the latter 2 references. Note: I believe this is a departure
|
623 | from jinja, which throws errors when referencing undefined objects. I feel
|
624 | that this is a good and non-breaking addition though. (thanks to devoidfury)
|
625 | * A bug in set where you couldn’t not reference other variables is fixed
|
626 | (thanks chriso and panta)
|
627 | * Other various small bugfixes
|
628 |
|
629 | You can view
|
630 | [all the code changes here](https://github.com/jlongster/nunjucks/compare/v0.1.5...v0.1.6). As
|
631 | always, [file an issue](https://github.com/jlongster/nunjucks/issues) if
|
632 | something breaks!
|
633 |
|
634 |
|
635 |
|
636 | v0.1.5 - macros, keyword arguments, bugfixes (Oct 11 2012)
|
637 | ----------------------------------------------------------
|
638 |
|
639 | v0.1.5 has been pushed to npm, and it’s a big one. Please file any issues you
|
640 | find, and I’ll fix them as soon as possible!
|
641 |
|
642 | * The node data structure has been completely refactored to reduce redundancy
|
643 | and make it easier to add more types in the future.
|
644 | * Thanks to Brent Hagany, macros now have been implemented. They should act
|
645 | exactly the way jinja2 macros do.
|
646 | * A calling convention which implements keyword arguments now exists. All
|
647 | keyword args are converted into a hash and passed as the last
|
648 | argument. Macros needed this to implement keyword/default arguments.
|
649 | * Function and filter calls apply the new keyword argument calling convention
|
650 | * The “set” block now appropriately only sets a variable for the current scope.
|
651 | * Many other bugfixes.
|
652 |
|
653 | I’m watching this release carefully because of the large amount of code that
|
654 | has changed, so please
|
655 | [file an issue](https://github.com/jlongster/nunjucks/issues) if you have a
|
656 | problem with it.
|
657 |
|
\ | No newline at end of file |