Still.Preprocessor.Renderer behaviour (Still v0.8.0) View Source

Defines the basic attributes of a markup renderer.

A renderer needs to implement a compile/2 function and an optional ast/0 function. When a markup file is being compiled, a module is created on demand. This module imports all template helpers defined by Still as well as any template helper configured by the user:

config :still,
  template_helpers: [Your.Module]

The created module implements a render/0 which will return the result of the compile/1 call.

The ast/0 can be used to tap into the AST of the new module and import or require any necessary module.

Markup renderers should use Still.Preprocessor.Renderer and provide two options:

Link to this section Summary

Link to this section Types

Specs

ast() :: {atom(), keyword(), list()}

Link to this section Callbacks

Specs

ast() :: ast()

Specs

compile(String.t()) :: ast()