Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render tree is distinct type from parse AST
- Loading branch information
Showing
10 changed files
with
123 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package render | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/osteele/liquid/expression" | ||
) | ||
|
||
// Node is a node of the render tree. | ||
type Node interface { | ||
} | ||
|
||
// BlockNode represents a {% tag %}…{% endtag %}. | ||
type BlockNode struct { | ||
Chunk | ||
renderer func(io.Writer, Context) error | ||
syntax BlockSyntax | ||
Body []Node | ||
Branches []*BlockNode | ||
} | ||
|
||
// RawNode holds the text between the start and end of a raw tag. | ||
type RawNode struct { | ||
slices []string | ||
} | ||
|
||
// FunctionalNode renders itself via a render function that is created during parsing. | ||
type FunctionalNode struct { | ||
Chunk | ||
render func(io.Writer, Context) error | ||
} | ||
|
||
// TextNode is a text chunk, that is rendered verbatim. | ||
type TextNode struct { | ||
Chunk | ||
} | ||
|
||
// ObjectNode is an {{ object }} object. | ||
type ObjectNode struct { | ||
Chunk | ||
expr expression.Expression | ||
} | ||
|
||
// SeqNode is a sequence of nodes. | ||
type SeqNode struct { | ||
Children []Node | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.