Safe compiler for versioned .paperforge declarative documents.
Templates are JSON documents containing data only. PaperForge never evaluates
Elixir source from a template. Variables are validated before conditions,
loops, and components are expanded into PaperForge.Flow, the public Layout
IR used by the existing pagination engine.
Summary
Functions
Clears the current process's bounded compiled-template cache.
Compiles a template and data into validated PaperForge.Flow Layout IR.
Compiles with a bounded process-local cache keyed by template, data, and safe options.
Loads and parses a .paperforge file.
Migrates an older declarative map to the current format version.
Parses JSON template content into a normalized map.
Compiles and renders a declarative template through the normal layout engine.
Returns the packaged JSON Schema path for editor and CI integration.
Validates template structure, input data, design references, and blocks.
Renders and writes a declarative document, keeping passwords in write-time options only.
Types
Functions
@spec clear_cache() :: :ok
Clears the current process's bounded compiled-template cache.
@spec compile(source(), map() | keyword(), keyword()) :: {:ok, PaperForge.Declarative.Compiled.t()} | {:error, [PaperForge.Declarative.Error.t()]}
Compiles a template and data into validated PaperForge.Flow Layout IR.
@spec compile_cached(source(), map() | keyword(), keyword()) :: {:ok, PaperForge.Declarative.Compiled.t()} | {:error, [PaperForge.Declarative.Error.t()]}
Compiles with a bounded process-local cache keyed by template, data, and safe options.
@spec load( Path.t(), keyword() ) :: {:ok, map()} | {:error, [PaperForge.Declarative.Error.t()]}
Loads and parses a .paperforge file.
Migrates an older declarative map to the current format version.
@spec parse(source()) :: {:ok, map()} | {:error, [PaperForge.Declarative.Error.t()]}
Parses JSON template content into a normalized map.
@spec render(source(), map() | keyword(), keyword()) :: {:ok, PaperForge.Document.t(), map()} | {:error, [PaperForge.Declarative.Error.t()]}
Compiles and renders a declarative template through the normal layout engine.
@spec schema_path() :: Path.t()
Returns the packaged JSON Schema path for editor and CI integration.
@spec validate(source(), map() | keyword(), keyword()) :: :ok | {:error, [PaperForge.Declarative.Error.t()]}
Validates template structure, input data, design references, and blocks.
@spec write(source(), map() | keyword(), Path.t(), keyword()) :: {:ok, map()} | {:error, [PaperForge.Declarative.Error.t()] | File.posix()}
Renders and writes a declarative document, keeping passwords in write-time options only.