View Source Surface.MacroComponent behaviour (surface v0.11.0)

A low-level component which is responsible for translating its own content at compile time.

Link to this section Summary

Callbacks

This function is called to expand a macro component into a set of Surface.AST nodes.

Functions

Evaluates the values of the static properties of a macro component.

Link to this section Callbacks

Link to this callback

expand(attributes, content, meta)

View Source
@callback expand(
  attributes :: [Surface.AST.Attribute.t()],
  content :: binary(),
  meta :: Surface.AST.Meta.t()
) :: Surface.AST.t() | [Surface.AST.t()]

This function is called to expand a macro component into a set of Surface.AST nodes.

Link to this section Functions

Link to this function

eval_static_props!(component, attributes, caller)

View Source

Evaluates the values of the static properties of a macro component.

Usually called inside translate/2 in order to retrieve the properties' values at compile-time.