View Source Surface.Compiler (surface v0.11.4)

Defines a behaviour that must be implemented by all HTML/Surface node translators.

This module also contains the main logic to translate Surface code.

Summary

Functions

This function compiles a string into the Surface AST.This is used by ~F and Surface.Renderer to parse and compile templates.

Functions

Link to this function

compile(string, line, caller, file \\ "nofile", opts \\ [])

View Source
@spec compile(binary(), non_neg_integer(), Macro.Env.t(), binary(), Keyword.t()) :: [
  Surface.AST.t()
]

This function compiles a string into the Surface AST.This is used by ~F and Surface.Renderer to parse and compile templates.

A special note for line: This is considered the line number for the first line in the string. If the first line of the string is also the first line of the file, then this should be 1. If this is being called within a macro (say to process a heredoc passed to ~F), this should be CALLER.line + 1.

Link to this function

to_ast(nodes, compile_meta)

View Source
Link to this function

to_live_struct(nodes, opts \\ [])

View Source
Link to this function

validate_component_structure(ast, meta, module)

View Source