Sablon.Processor.Document.FieldHandlers behaviour (sablon v0.4.3)

Copy Markdown View Source

Turns merge fields into statements.

A handler claims a field by matching its expression and then builds the matching statement, consuming further fields from the construction state when the statement spans a block. Custom handlers are registered with Sablon.Processor.Document.register_field_handler/2.

Summary

Callbacks

Builds a statement for field.

Whether this handler can process field.

Callbacks

build_statement(t, term, keyword)

Builds a statement for field.

Returns the statement (or nil when the field produces none) together with the updated construction state.

handles?(term)

@callback handles?(term()) :: boolean()

Whether this handler can process field.