View Source API Reference alembic v0.1.0

Modules

Alembic — a Liquid-compatible template engine for Elixir, with zero runtime dependencies.

The abstract syntax tree Alembic.Parser produces and Alembic.Evaluator walks. Every node is a tagged tuple, chosen over structs so pattern matching in the evaluator stays exhaustive — adding a node type without handling it produces a compiler warning, not a silent no-op.

OTP application callback module. Validates configuration (Alembic.Config.validate!/0) and starts a one_for_one supervisor whose only child is Alembic.Cache — the cache's ETS table is owned by that GenServer, so this supervisor is what recreates it if the cache process ever crashes.

OTP GenServer owning a :public ETS table used as a compiled-template cache, keyed by {path, mtime}. A cache hit skips the tokenize → parse pipeline entirely; a modified source file (different mtime) is a different key, so it is automatically a miss.

A more specific compile-time error than Alembic.TemplateError — carries the offending template source alongside the reason. Defined per issue 1.5.3's task list for callers who want a narrower rescue clause; the bang functions themselves raise the general Alembic.TemplateError.

Reads and validates :alembic application configuration.

Runtime variable store the Evaluator uses to resolve variable paths.

Tree-walking interpreter: walks an Alembic.AST.t() against a Alembic.Context, resolves variables and expressions, applies filters, and emits the rendered output as a string.

Behaviour for custom Alembic filters.

Built-in, Liquid-compatible filter library. Zero runtime dependencies — everything below uses only Elixir/OTP stdlib.

Template inheritance: {% extends "base.html" %} / {% block name %} / {% endblock %} and multi-level chains. Pure — no direct file I/O; a loader function is injected so this module is testable without a filesystem.

Convert Alembic template source into lexical tokens.

Resolves template names to files across one or more configured template root directories and reads their contents. Supports multiple roots (checked in order, first match wins), automatic extension appending when a template name has none, and path-traversal protection.

Recursive descent parser: turns the flat token list produced by Alembic.Lexer into a typed Alembic.AST.t().

Parses the raw string content of a Liquid expression — everything that can appear inside {{ ... }} output tags and {% if ... %} / {% for ... in ... %} conditions — into an Alembic.AST.expr() node.

A more specific render-time error than Alembic.TemplateError — carries the template and a truncated view of the assigns alongside the reason. Defined per issue 1.5.3's task list for callers who want a narrower rescue clause; the bang functions themselves raise the general Alembic.TemplateError.

Raised by every bang (!) Alembic function (compile!/2, render!/3, render_file!/3) when the underlying non-bang call returns {:error, reason}.

The three token classes Alembic.Lexer.tokenize/1 produces.