From version 1.1 >
edited by Thomas Mortagne
on 2020/01/20
To version < 2.1 >
edited by Thomas Mortagne
on 2020/01/20
>
Change comment: There is no comment for this version

Summary

Details

ReleaseNotes.Code.ChangesClass[0]
Short Description
... ... @@ -1,6 +1,6 @@
1 1  After 9 years Velocity finally got a update. You can see a detailed changelog on https://velocity.apache.org/engine/2.2/changes.html but here are the important new things from XWiki script authors:
2 2  
3 -* Allow expressions inside []: {{code language="velocity"}}$foo[$bar + 1]{{/velocity}}
3 +* Allow expressions inside []: {{code language="velocity"}}$foo[$bar + 1]{{/code}}
4 4  * New strategy for reference boolean evaluation:
5 5  ** return false for a null object
6 6  ** return its value for a Boolean object, or the result of the getAsBoolean() method if it exists.

After 9 years Velocity finally got a update. You can see a detailed changelog on https://velocity.apache.org/engine/2.2/changes.html but here are the important new things from XWiki script authors:

  • Allow expressions inside []: $foo[$bar + 1]
  • Allow expressions inside []: $foo[$bar + 1]{{/velocity}}
    * New strategy for reference boolean evaluation:
    ** return false for a null object
    ** return its value for a Boolean object, or the result of the getAsBoolean() method if it exists.
    ** if directive.if.emptycheck is false (true by default), stop here and return true.
    ** check for emptiness:
    *** return whether an array is empty.
    *** return whether isEmpty() is false (covers String and all Collection classes).
    *** return whether length() is zero (covers CharSequence classes other than String).
    *** returns whether size() is zero.
    *** return whether a Number strictly equals zero.
    ** check for emptiness after explicit conversion methods:
    *** return whether the result of getAsString() is empty (and false for a null result) if it exists.
    *** return whether the result of getAsNumber() strictly equals zero (and false for a null result) if it exists.
    * support $array.empty, as for $list.empty
    * fix parsing of $obj._method()
    * have #foreach honnor the Closeable interface on the iterator
    * Fix regression: #setleft-paren no longer valid grammar
    * fix parser for '$map{key}' text rendering
    * #foreach should work over any Iterable class
    * Method arguments can now be expressions
    * Fixed quotes escaping so that doubling single quotes only works when enclosing quotes are single quotes (and same behaviour for double quotes)
    * Add ability to specify default values for macro parameters, e.g.; #macro(foo bar=1)
    * Add ability to place line comments next to macro parameter definitions
    * Block directives no longer require parenthesis so #@foo #end is now allowed. Also, brackets now work with Block Macros so #{@foo}bar#end works
    * Default block for empty loops: #foreach($i in []) loop block #else empty #end
    * Rendering of arrays should display their content, as for lists
  • New strategy for reference boolean evaluation:
    • return false for a null object
    • return its value for a Boolean object, or the result of the getAsBoolean() method if it exists.
    • if directive.if.emptycheck is false (true by default), stop here and return true.
    • check for emptiness:
      • return whether an array is empty.
      • return whether isEmpty() is false (covers String and all Collection classes).
      • return whether length() is zero (covers CharSequence classes other than String).
      • returns whether size() is zero.
      • return whether a Number strictly equals zero.
    • check for emptiness after explicit conversion methods:
      • return whether the result of getAsString() is empty (and false for a null result) if it exists.
      • return whether the result of getAsNumber() strictly equals zero (and false for a null result) if it exists.
  • support $array.empty, as for $list.empty
  • fix parsing of $obj._method()
  • have #foreach honnor the Closeable interface on the iterator
  • Fix regression: #setleft-paren no longer valid grammar
  • fix parser for '$map{key}' text rendering
  • #foreach should work over any Iterable class
  • Method arguments can now be expressions
  • Fixed quotes escaping so that doubling single quotes only works when enclosing quotes are single quotes (and same behaviour for double quotes)
  • Add ability to specify default values for macro parameters, e.g.; #macro(foo bar=1)
  • Add ability to place line comments next to macro parameter definitions
  • Block directives no longer require parenthesis so #@foo #end is now allowed. Also, brackets now work with Block Macros so #{@foo}bar#end works
  • Default block for empty loops: #foreach($i in []) loop block #else empty #end
  • Rendering of arrays should display their content, as for lists

Get Connected