sort filter;
respect throwOnUndefined if sort attribute is undefined.base arg to
int filter.chokidar to peerDependencies and mark it optional in peerDependenciesMeta.select and
reject filters.
Merge of #1278 and
#1279; fixes
#282. Thanks
ogonkov!TypeError: name.replace is not a function.
Fixes #1295.groupby filter;
respect throwOnUndefined option, if the groupby attribute is undefined.
Merge of #1276; fixes
#1198. Thanks
ogonkov!indent filter no longer appends an additional newline. Fixes
#1231.^2.0.0 to ^3.3.0. Merge of
#1254. Thanks
eklingen.NodeResolveLoader,
a Loader that loads templates using node's
require.resolve.
Fixes #1175.Environment instances, to allow runtime dependency
tracking. Fixes #1153.Removes deprecated postinstall-build package in favor of npm prepare. Merge of #1172. Fixes #1167.
No code changes; fixed npm packaging issue.
Add forceescape filter. Fixes #782
Fix regression that prevented template errors from reporting line and column number. Fixes #1087 and #1095.
Fix "Invalid type: Is" error for {% if value is defined %}. Fixes
#1110
Formally drop support for node v4 (the upgrade to babel 7 in 3.1.0 made the build process incompatible with node < 6.9.0).
chokidar an optional dependency again. Fixes
#1073npm install nunjucks with the --no-bin-links flagSupport nunjucks.installJinjaCompat() with slim build. Fixes #1019
Fix calling render callback twice when a conditional import throws an error. Solves #1029
Support objects created with Object.create(null). fixes #468
Support ESNext iterators, using Array.from. Merge of #1058
Fix handling methods and attributes of static arrays, objects and primitives. Solves the issue #937
Add support for python-style array slices with Jinja compat enabled. Fixes #188; merge of #976.
Fix call blocks having access to their parent scope. Fixes #906; merge of #994.
Fix a bug that caused capturing block tags (e.g. set/endset, filter/endfilter) to write to the global buffer rather than capturing their contents. Fixes #914 and #972; merge of #990. Thanks Noah Lange.
Allow including many templates without reaching recursion limits. Merge of #787. Thanks Gleb Khudyakov.
Allow explicitly setting null (aka none) as the value of a variable;
don't ignore that value and look on up the frame stack or context. Fixes
#478. Thanks Jonny Gerig
Meyer for the report.
Execute blocks in a child frame that can't write to its parent. This means
that vars set inside blocks will not leak outside of the block, base
templates can no longer see vars set in templates that inherit them, and
super() can no longer set vars in its calling scope. Fixes the inheritance
portion of #561, which
fully closes that issue. Thanks legutierr for the report.
Prevent macros from seeing or affecting their calling scope. Merge of #667.
Fix handling of macro arg with default value which shares a name with another macro. Merge of #791.
Add support for the spaces parameter in the dump template filter. Merge of #868. Thanks Jesse Eikema
Add verbatim as an alias of raw for compatibility with Twig.
Merge of #874.
Add new nl2br filter. Thanks Marc-Aurèle Darche
Add support for python's list.append with Jinja compat enabled. Thanks
Conor Flannigan.
Add variables whitespace control.
.toString in safe filter.
Merge of #849.undefined and null behavior in escape and safe filter.
Merge of #843.Add elseif as an alias of elif for parity with Twig. Thanks kswedberg.
Merge of #826.
Add nunjucks env to express app settings as nunjucksEnv.
Merge of #829.
Add support for finding an object's "length" in length filter. Merge of #813.
Ensure that precompiling on Windows still outputs POSIX-style path separators. Merge of #761.
Add support for strict type check comparisons (=== and !==). Thanks oughter. Merge of #746.
Allow full expressions (incl. filters) in import and from tags. Thanks legutierr. Merge of #710.
OS agnostic file paths in precompile. Merge of #825.
escape filter.
Thanks Matt Austin for the report and Thomas Hunkapiller for the fix.
#836Fix use of in operator with strings. Fixes
#714. Thanks Zubrik for the
report.
Support ES2015 Map and Set in length filter. Merge of
#705. Thanks ricordisamoa.
Remove truncation of long function names in error messages. Thanks Daniel Bendavid. Merge of #702.
Don't double-escape. Thanks legutierr. Merge of #701.
Prevent filter.escape from escaping SafeString. Thanks atian25. Merge of #623.
Throw an error if a block is defined multiple times. Refs #696.
Officially recommend the .njk extension. Thanks David Kebler. Merge of
#691.
Allow block-set to wrap an inheritance block. Unreported; fixed as a side effect of the fix for #576.
Fix filter tag with non-trivial contents. Thanks Stefan Cruz and Fabien
Franzen for report and investigation, Jan Oopkaup for failing tests. Fixes
#576.
Allow retrieving boolean-false as a global. Thanks Marius Büscher. Merge of #694.
Don't automatically convert any for-loop that has an include statement into an async loop. Reverts 7d4716f4fd, re-opens #372, fixes #527. Thanks Tom Delmas for the report.
Switch from Optimist to Yargs for argument-parsing. Thanks Bogdan Chadkin. Merge of #672.
Prevent includes from writing to their including scope. Merge of #667 (only partially backported to 2.x; macro var visibility not backported).
Fix handling of dev environment option, to get full tracebacks on errors
(including nunjucks internals). Thanks Tobias Petry and Chandrasekhar Ambula
V for the report, Aleksandr Motsjonov for draft patch.
Support using in operator to search in both arrays and objects,
and it will throw an error for other data types.
Fix #659.
Thanks Alex Mayfield for report and test, Ouyang Yadong for fix.
Merge of #661.
Add support for {% set %} block assignments as in jinja2. Thanks Daniele
Rapagnani. Merge of #656
Fix {% set %} scoping within macros.
Fixes #577 and
the macro portion of #561.
Thanks Ouyang Yadong. Merge of #653.
Add support for named endblock (e.g. {% endblock foo %}). Thanks
ricordisamoa. Merge of #641.
Fix range global with zero as stop-value. Thanks Thomas Hunkapiller. Merge
of #638.
Fix a bug in urlize that collapsed whitespace. Thanks Paulo Bu. Merge of #637.
Add sum filter. Thanks Pablo Matías Lazo. Merge of
#629.
Don't suppress errors inside {% if %} tags. Thanks Artemy Tregubenko for report and test, Ouyang Yadong for fix. Merge of #634.
Allow whitespace control on comment blocks, too. Thanks Ouyang Yadong. Merge of #632.
Fix whitespace control around nested tags/variables/comments. Thanks Ouyang Yadong. Merge of #631.
Return null from WebLoader on missing template instead of throwing an
error, for consistency with other loaders. This allows WebLoader to support
the new ignore missing flag on the include tag. If ignore missing is
not set, a generic "template not found" error will still be thrown, just like
for any other loader. Ajax errors other than 404 will still cause WebLoader
to throw an error directly.
Add preserve-linebreaks option to striptags filter. Thanks Ivan
Kleshnin. Merge of #619.
striptags filter. Thanks Anthony Giniers. Merge of
#589.default filter without specifying
a third argument. Merge of
#567.include now supports an option to suppress errors if the template does not
exist. Thanks Mathias Nestler. Merge of
#559WebLoader without opts. Merge of
#524.hasExtension and removeExtension methods to Environment. Merge of
#512.sort filter. Merge of
#510.none as a lexed constant evaluating to null. Merge of
#480.raw blocks. Thanks Aaron O'Mullan. Merge of
#503.Most of the changes can be summed up in the issues tagged 2.0.
Or you can see all commits.
Most important changes:
{
autoescape: false } in the options to turn it off.{ watch: true } to
start the watcher.default filter has changed. It will show the default value only if the
argument is undefined. Any other value, even false-y values like false
and null, will be returned. You can get back the old behavior by passing
true as a 3rd argument to activate the loose-y behavior: foo |
default("bar", true). In 2.0 if you don't pass the 3rd argument, a warning
will be displayed about this change in behavior. In 2.1 this warning will be
removed.This is an extremely minor release that only adds an .npmignore so that the bench, tests, and docs folders do not get published to npm. Nunjucks should download a lot faster now.
This is exactly the same as v1.3.1, just fixing a typo in the git version tag.
(no notes)
We added strict mode to all the files, but that broke running nunjucks in the browser. Should work now with this small fix.
User visible changes:
Dev changes:
Mixed up a few things in the 1.0.6 release, so another small bump. This merges in one thing:
(v1.0.3 is skipped because it was published with a bad URL, quickly fixed with another version bump)
(no notes)
(no notes)
(no notes)
There are lots of cool new features in this release, as well as many critical bug fixes.
Full list of changes:
for loops implement Python-style array unpacking. This is a really nice
feature which lets you do this:
{% for x, y, z in [[2, 2, 2], [3, 3, 3]] %} --{{ x }} {{ y }} {{ z }}-- {% endfor %}
The above would output: --2 2 2----3 3 3--
You can pass any number of variable names to for and it will destructure each array in the list to the variables.
This makes the syntax between arrays and objects more
consistent. Additionally, it allows us to implement the dictsort filter
which sorts an object by keys or values. Technically, it returns an array of
2-value arrays and the unpacking takes care of it. Example:
{% for k, v in { b: 2, a: 1 } %}
--{{ k }}: {{ v }}--
{% endfor %}
Output: --b: 2----a: 1-- (note: the order could actually be anything
because it uses javascript’s for k in obj syntax to iterate, and ordering
depends on the js implementation)
{% for k, v in { b: 2, a: 1} | dictsort %}
--{{ k }}: {{ v }}--
{% endfor %}
Output: --a: 1----b: 2--
The above output will always be ordered that way. See the documentation for more details.
Thanks to novocaine for this!
The biggest change in v0.1.7 comes from devoidfury (thanks!) which implements consistent and helpful error messages. The errors are still simply raw text, and not pretty HTML, but they at least contain all the necessary information to track down an error, such as template names, line and column numbers, and the inheritance stack. So if an error happens in a child template, it will print out all the templates that it inherits. In the future, we will most likely display the actual line causing an error.
Full list of changes:
You can view all the code changes here. Please file an issue if something breaks!
This is mostly a bugfix release, but there are a few small tweaks based on feedback:
You can view all the code changes here. As always, file an issue if something breaks!
v0.1.5 has been pushed to npm, and it’s a big one. Please file any issues you find, and I’ll fix them as soon as possible!
I’m watching this release carefully because of the large amount of code that has changed, so please file an issue if you have a problem with it.