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

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

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.

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.

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.