1
0
mirror of https://github.com/danog/liquid.git synced 2024-11-27 08:44:40 +01:00
liquid/render/nodes.go

48 lines
899 B
Go
Raw Normal View History

package render
import (
"io"
"github.com/osteele/liquid/expression"
2017-07-07 11:41:37 +02:00
"github.com/osteele/liquid/parser"
)
// Node is a node of the render tree.
type Node interface {
}
// BlockNode represents a {% tag %}…{% endtag %}.
type BlockNode struct {
2017-07-07 11:41:37 +02:00
parser.Chunk
renderer func(io.Writer, Context) error
Body []Node
Branches []*BlockNode
}
// RawNode holds the text between the start and end of a raw tag.
type RawNode struct {
slices []string
}
2017-07-06 15:40:37 +02:00
// TagNode renders itself via a render function that is created during parsing.
type TagNode struct {
2017-07-07 11:41:37 +02:00
parser.Chunk
2017-07-06 15:40:37 +02:00
renderer func(io.Writer, Context) error
}
// TextNode is a text chunk, that is rendered verbatim.
type TextNode struct {
2017-07-07 11:41:37 +02:00
parser.Chunk
}
// ObjectNode is an {{ object }} object.
type ObjectNode struct {
2017-07-07 11:41:37 +02:00
parser.Chunk
expr expression.Expression
}
// SeqNode is a sequence of nodes.
type SeqNode struct {
Children []Node
}