Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTBlock ¶
type ASTBlock struct {
Token
Body []ASTNode // Body is the nodes before the first branch
Branches []*ASTBlock // E.g. else and elseif w/in an if
// contains filtered or unexported fields
}
ASTBlock represents a {% tag %}…{% endtag %}.
type ASTObject ¶
type ASTObject struct {
Token
Expr expression.Expression
}
ASTObject is an {{ object }} object.
type ASTRaw ¶
type ASTRaw struct {
Slices []string
}
ASTRaw holds the text between the start and end of a raw tag.
type ASTTag ¶
type ASTTag struct {
Token
}
ASTTag is a tag {% tag %} that is not a block start or end.
type BlockSyntax ¶
type BlockSyntax interface {
IsBlock() bool
CanHaveParent(BlockSyntax) bool
IsBlockEnd() bool
IsBlockStart() bool
IsBranch() bool
ParentTags() []string
RequiresParent() bool
TagName() string
}
BlockSyntax supplies the parser with syntax information about blocks.
type Config ¶
type Config struct {
expression.Config
Grammar Grammar
Filename string
LineNo int
}
A Config holds configuration information for parsing and rendering.
type Grammar ¶
type Grammar interface {
BlockSyntax(string) (BlockSyntax, bool)
}
Grammar supplies the parser with syntax information about blocks.
type ParseError ¶
type ParseError string
A ParseError is a parse error during the template parsing.
func (ParseError) Error ¶
func (e ParseError) Error() string
type SourceInfo ¶
type SourceInfo struct {
Pathname string
// contains filtered or unexported fields
}
SourceInfo contains a Chunk's source information
func (SourceInfo) String ¶
func (s SourceInfo) String() string
type Token ¶
type Token struct {
Type TokenType
SourceInfo SourceInfo
Name string // Name is the tag name of a tag Chunk. E.g. the tag name of "{% if 1 %}" is "if".
Args string // Parameters is the tag arguments of a tag Chunk. E.g. the tag arguments of "{% if 1 %}" is "1".
Source string // Source is the entirety of the token, including the "{{", "{%", etc. markers.
}
A Token is either an object {{a.b}}, a tag {%if a>b%}, or a text chunk (anything outside of {{}} and {%%}.)
Click to show internal directories.
Click to hide internal directories.