x_component v0.1.0 X.Ast View Source

Contains X template AST type definitions and functions to work with the AST.

Link to this section Summary

Functions

Removes tailing and leading whitespace nodes from the given AST.

Link to this section Types

Link to this type

cursor()

View Source
cursor() :: {column :: integer(), row :: integer()}
Link to this type

leaf()

View Source
leaf() :: {token :: token(), children :: [leaf()]}
Link to this type

tag_attr()

View Source
tag_attr() ::
  {:tag_attr, cursor(), name :: charlist(), value :: charlist(),
   is_dynamic :: boolean()}
Link to this type

tag_comment()

View Source
tag_comment() :: {:tag_comment, cursor :: cursor(), value :: charlist()}
Link to this type

tag_condition()

View Source
tag_condition() ::
  {condition :: :if | :else | :elseif | :unless, cursor :: cursor(),
   value :: charlist()}
Link to this type

tag_end()

View Source
tag_end() :: {:tag_end, cursor :: cursor(), name :: charlist()}
Link to this type

tag_iterator()

View Source
tag_iterator() :: {iterator :: :for, cursor :: cursor(), value :: charlist()}
Link to this type

tag_output()

View Source
tag_output() ::
  {:tag_output, cursor :: cursor(), value :: charlist(),
   is_html_escape :: boolean()}
Link to this type

tag_start()

View Source
tag_start() ::
  {:tag_start, cursor :: cursor(), name :: charlist(),
   attributes :: [tag_attr()], condition :: tag_condition(),
   iterator :: tag_iterator(), is_singleton :: boolean(),
   is_selfclosed :: boolean(), is_component :: boolean()}
Link to this type

tag_text()

View Source
tag_text() ::
  {:tag_text, cursor :: cursor(), value :: charlist(),
   is_leading_whitespace :: boolean(), is_blank :: boolean()}
Link to this type

text_group()

View Source
text_group() :: {:text_group, cursor :: cursor(), tag_name :: charlist()}

Link to this section Functions

Link to this function

drop_whitespace(tree)

View Source
drop_whitespace([leaf()]) :: [leaf()]

Removes tailing and leading whitespace nodes from the given AST.