Helma Logo
main list history
previous version  overview  next version

Version 6 by hannes on 16. March 2007, 11:23

Helma 1.6 contains a number of Skin/Macro enhancements that aim to make Helma's rendering infrastructure more flexible and powerful.

=== Macro pipes/filters ===

  <% text | truncate max="300" | uppercase %>

Filter functions must have a _filter suffix and get two arguments: the return value of the previous macro/filter in the chain, and a parameter object with the attributs in the filter tag. They are expected to return the filtered macro output. Macro and filter return values are converted to string only at the end of the chain. It is therefore possible to pass other objects between macros and filters:

  <% now | format %>

  function now_macro(param) {
    return new Date();
  function format_filter(arg, param) {
    return arg.format();

=== Deep/Reach-through macro invocation ===

Helma 1.6 allows macros to be invoked over several property path links.

  <% page.author.name %>

=== Nested Macros ===

Helma 1.6 allows macros as macro attribute values.

  <% page.link content=<% messages.storylink %> %>

The main reasons to reject this over the years have been that this is ugly, and that it results in unreadable skins. But then, isn't recursion one of the coolest concepts in programming? If you think it's ugly, just don't use it. Otherwise, it may save you a handsome amount of macro writing.

=== failmode attribute ===

Helma macros support a new standard attribute, in addition to <code>prefix</code>, <code>suffix</code>, <code>default</code> and <code>encoding</code>.

The <code>failmode</code> attribute, if defined, will cause error messages for failed or unresolved macros to be generated or suppressed.

  <% failLoudly failmode="verbose" %>
  <% failQuitely failmode="silent" %>

The default value is silent for request/response/session/param handlers, and verbose for app object handlers (mimicking implicit Helma 1.5 behaviour).

=== Compatibility issues ===

All the changes and new features in Helma 1.6 skins are backwards compatible with Helma 1.5.

=== Security issues ===