jshsj124/moontemplate/types does not have a README file

    ContextValue

    pub(all) enum ContextValue {
    Str(String)
    List(Array[ContextValue])
    Object(Array[(String, ContextValue)])
    } derive(Eq)

    A template context value: either a string or a nested array.

    Helper

    pub(all) struct Helper {
    name : String
    func : (String) -> String
    }

    A helper function that takes a string argument and returns a string.

    Node

    pub(all) enum Node {
    Text(String)
    Var(String)
    Unescaped(String)
    If(String, Array[Node])
    IfElse(String, Array[Node], Array[Node])
    Unless(String, Array[Node])
    UnlessElse(String, Array[Node], Array[Node])
    Each(String, String, Array[Node])
    Root(Array[Node])
    }

    An AST node produced by the parser.

    Partial

    pub(all) struct Partial {
    name : String
    template : String
    } derive(Eq)

    A partial template loaded by name.

    TemplateError

    pub(all) struct TemplateError {
    message : String
    line : Int
    column : Int
    } derive(Eq)

    A template error with location info.

    Token

    pub(all) enum Token {
    Text(String)
    Var(String)
    Open(String, String)
    Close(String)
    Unescaped(String)
    Comment(String)
    }

    A token produced by the lexer.

    context_flatten

    fn context_flatten(value : ContextValue) -> Array[(String, ContextValue)]

    Flatten a ContextValue to a simple key-value array (for nested each).

    context_from_pairs

    fn context_from_pairs(pairs : Array[(String, String)]) -> Array[(String, ContextValue)]

    Build context from a flat array of string pairs.

    context_lookup

    fn context_lookup(key : String, ctx : Array[(String, ContextValue)]) -> String

    Lookup a key in a context array (returns empty string if not found).

    format_template_error

    fn format_template_error(err : TemplateError) -> String

    Format a template error for display.

    template_error

    fn template_error(message : String, line : Int, column : Int) -> TemplateError

    Create a template error.

    Source Files