Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document represents an abstract syntax tree document.
func (*Document) MarshalJSON ¶
MarshalJSON returns the JSON encoding of the document.
type Node ¶
type Node interface {
// String returns a string representation of the node.
String() string
// Children returns the children nodes of the node.
Children() []Node
// Append appends a child node to the node.
Append(node Node)
}
Node represents a node in an abstract syntax tree.
type TemplateNode ¶
type TemplateNode struct {
// Token is the token associated with the template node.
Token *token.Token
// Closed indicates whether the template tag is closed.
Closed bool
// Ident is the identifier of the template tag.
Ident string
// contains filtered or unexported fields
}
TemplateNode represents a node in the abstract syntax tree corresponding to a template tag.
func NewTemplateNode ¶
func NewTemplateNode(tok *token.Token) *TemplateNode
NewTemplateNode creates a new TemplateNode instance from the given token.
func (*TemplateNode) Append ¶
func (tn *TemplateNode) Append(node Node)
Append appends a child node to the template node.
func (*TemplateNode) Children ¶
func (tn *TemplateNode) Children() []Node
Children returns the children nodes of the template node.
func (*TemplateNode) MarshalJSON ¶
func (tn *TemplateNode) MarshalJSON() ([]byte, error)
MarshalJSON returns the JSON encoding of the template node.
func (*TemplateNode) String ¶
func (tn *TemplateNode) String() string
String returns the string representation of the template node.
type TextNode ¶
TextNode represents a node in the abstract syntax tree corresponding to text.
func (*TextNode) Append ¶
Append panics when attempting to append a child node to a text node, as text nodes cannot have children.
func (*TextNode) MarshalJSON ¶
MarshalJSON returns the JSON encoding of the text node.