Braces.Handlebars.Helpers.Options (Braces v0.1.0)

Copy Markdown View Source

The last argument of a custom helper (see Braces.Handlebars.Helpers), as Handlebars.js's options:

  • name: the helper's name as the template writes it;
  • hash: the key=value arguments, with string keys;
  • data: the @ variables, with string keys, such as "root" and "index";
  • this: the context the helper is called in;
  • fn and inverse: for a block helper, functions that render the block and its {{else}} block with a context, giving text; nil in {{helper}}. Without {{else}}, inverse gives "". Braces.Handlebars.Helpers.render_block/3 adds @ variables and block params;
  • block_params: how many block params the block declares (as |a b| is 2);
  • loc: the tag's position in the template.

Summary

Types

t()

@type t() :: %Braces.Handlebars.Helpers.Options{
  block_params: non_neg_integer(),
  data: map(),
  fn: (term() -> String.t()) | nil,
  hash: %{required(String.t()) => term()},
  inverse: (term() -> String.t()) | nil,
  loc: map() | nil,
  name: String.t(),
  render: (atom(), term(), keyword() -> String.t()),
  this: term()
}