x_component v0.1.0 X.Compiler View Source
X template compiler module.
Link to this section Summary
Functions
Compiles given X template AST into Elixir AST.
Link to this section Types
Link to this section Functions
Link to this function
call(tree, env \\ __ENV__, opts \\ [])
View Sourcecall([X.Ast.leaf()], Macro.Env.t(), options()) :: Macro.t()
Compiles given X template AST into Elixir AST.
Example
iex> X.Compiler.call(
...> [
...> {{:tag_start, {1, 1}, 'div', [], nil, nil, false, false, false},
...> [
...> {{:tag_start, {6, 1}, 'span',
...> [{:tag_attr, {12, 1}, 'class', 'test', false}], nil, nil, false, false,
...> false},
...> [
...> {{:text_group, {25, 1}, 'span'},
...> [{{:tag_output, {25, 1}, 'a ', true}, []}]}
...> ]}
...> ]}
...> ])
[
"<div><span class=\"test\">",
{{:., [line: 1],
[{:__aliases__, [line: 1, alias: false], [:X, :Html]}, :to_safe_iodata]},
[line: 1], [{:a, [line: 1], nil}]},
"</span></div>"
]
Link to this function
group_and_transform_component_attrs(attrs, env, opts)
View Sourcegroup_and_transform_component_attrs( [X.Ast.tag_attr()], Macro.Env.t(), options() ) :: {attrs_ast :: Macro.t() | nil, assigns_ast :: Macro.t() | nil, assigns_list :: [{binary(), Macro.t()}], attrs_list :: [{binary(), Macro.t()}], merge_attrs_list :: [X.Ast.tag_attr()]}