Global registries for the pluggable parts of sablon.
The Ruby gem keeps these on class level (Sablon::Template.processors,
Sablon::Processor::Document.field_handlers, Sablon::Content.types and
Sablon::DOM.handlers). They are all ordered lookups where the first match
wins, so every registry is stored as an ordered list.
Summary
Functions
Returns a specification to start this module under a supervisor.
Looks up a content type module by id.
All registered content types as {id, module} pairs, in registration order.
The fallback field handler, if one is registered.
The DOM handler for entry_name, or nil when the entry needs no special handling.
All registered field handlers, in registration order.
Returns the processors registered for the first pattern matching entry_name.
Registers a content type module under its id/0.
Registers a DOM handler for zip entries matching pattern.
Registers a merge field handler.
Registers a processor for every zip entry whose name matches pattern.
Removes a content type, either by its id or by the module itself.
Removes a field handler, returning it.
Replaces an existing field handler.
Restores the built-in registrations, discarding every customisation.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Looks up a content type module by id.
All registered content types as {id, module} pairs, in registration order.
@spec default_field_handler() :: module() | nil
The fallback field handler, if one is registered.
The DOM handler for entry_name, or nil when the entry needs no special handling.
@spec field_handlers() :: [module()]
All registered field handlers, in registration order.
Returns the processors registered for the first pattern matching entry_name.
@spec register_content_type(module()) :: :ok
Registers a content type module under its id/0.
Registers a DOM handler for zip entries matching pattern.
Registers a merge field handler.
The special name :default registers the fallback handler used when no
other handler claims a field. Registering an existing name raises; use
replace_field_handler/2 instead.
Registers a processor for every zip entry whose name matches pattern.
Multiple processors can share a pattern; pass replace_all: true to drop
the ones already registered for it.
Removes a content type, either by its id or by the module itself.
Removes a field handler, returning it.
Replaces an existing field handler.
@spec reset() :: :ok
Restores the built-in registrations, discarding every customisation.