All Versions
44
Latest Version
Avg Release Cycle
86 days
Latest Release
1138 days ago

Changelog History
Page 5

  • v0.1.8 Changes

    February 06, 2013

    ๐Ÿš‘ There are lots of cool new features in this release, as well as many critical ๐Ÿ› bug fixes.

    Full list of changes:

    • Whitespace control is implemented. Use {%- and -%} to strip whitespace before/after the block.
    • ๐Ÿ’… 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!

    • ๐Ÿ‘ Much better error handling with at runtime (shows template/line/col information for attempting to call undefined values, etc)
    • ๐Ÿ›  Fixed a regression which broke the {% raw %} block
    • ๐Ÿ›  Fix some edge cases with variable lookups
    • ๐Ÿ›  Fix a regression with loading precompiled templates
    • ๐Ÿ‘‰ Tweaks to allow usage with YUICompressor
    • ๐Ÿ‘‰ Use the same error handling as normal when precompiling (shows proper errors)
    • ๐Ÿ›  Fix template loading on Windows machines
    • ๐Ÿ›  Fix int/float filters
    • ๐Ÿ›  Fix regression with super()
  • v0.1.7 Changes

    December 12, 2012

    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:

    • Consistent and helpful error messages
    • Expressions are more consistent now. Previously, there were several places that wouldnโ€™t accept an arbitrary expression that should. For example, you can now do {% include templateNames['foo'] %}, whereas previously you could only give it a simply variable name.
    • ๐Ÿ›  app.locals is fixed with express 2.5
    • Method calls on objects now have correct scope for this. Version 0.1.6 broke this and this was referencing the global scope.
    • A check was added to enforce loading of templates within the correct path. Previously you could load a file outside of the template with something like ../../crazyPrivateFile.txt

    You can view all the code changes here. Please file an issue if something breaks!

  • v0.1.6 Changes

    November 13, 2012

    ๐Ÿ›  This is mostly a bugfix release, but there are a few small tweaks based on feedback:

    • In some cases, backslashes in the template would not appear in the output. This has been fixed.
    • An error is thrown if a filter is not found
    • โœ… Old versions of express are now supported (2.5.11 was tested)
    • References on undefined objects are now suppressed. For example, {{ foo }}, {{ foo.bar }}, {{ foo.bar.baz }} all output nothing if foo is undefined. Previously only the first form would be suppressed, and a cryptic error thrown for the latter 2 references. Note: I believe this is a departure from jinja, which throws errors when referencing undefined objects. I feel that this is a good and non-breaking addition though. (thanks to devoidfury)
    • ๐Ÿ›  A bug in set where you couldnโ€™t not reference other variables is fixed (thanks chriso and panta)
    • ๐Ÿ›  Other various small bugfixes

    You can view all the code changes here. As always, file an issue if something breaks!

  • v0.1.5 Changes

    October 11, 2012

    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!

    • ๐Ÿ”จ The node data structure has been completely refactored to reduce redundancy and make it easier to add more types in the future.
    • Thanks to Brent Hagany, macros now have been implemented. They should act exactly the way jinja2 macros do.
    • A calling convention which implements keyword arguments now exists. All keyword args are converted into a hash and passed as the last argument. Macros needed this to implement keyword/default arguments.
    • Function and filter calls apply the new keyword argument calling convention
    • The โ€œsetโ€ block now appropriately only sets a variable for the current scope.
    • ๐Ÿ›  Many other bugfixes.

    ๐Ÿš€ 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.