Dust-motes

HELPERS / MISCELLANEOUS

extend

{@extend helper=string|filter=string /}code{/extend}

Define ad hoc custom helper or filter

Parameters:

  • helper : string specifying name of the helper
  • filter : string specifying the name of the filter

The body of the extend tag has the JavaScript defining a custom helper named by the helper param or it contains the JavaScript defining a custom filter named by the filter param.

Examples:


{@extend  helper="assist"}
function assist (chk, ctx, bodies, params) {
        var key = dust.helpers.tap(params.key, chk, ctx);
        return chk.write(key + key);
}
{/extend}
{@assist key="go"/}

{@extend filter="my"}
function myfilter(string) {return  "***" + string + "***"; };
{/extend}

FILTERED: {str | my}