Documentation
¶
Index ¶
- Constants
- func Inspect(node Node, f func(Node) bool)
- func Walk(v Visitor, node Node) error
- type BinOperator
- type BinaryExpression
- type BlockSet
- type Bool
- type Call
- type Comment
- type Data
- type Dict
- type Expression
- type FilterCall
- type FilteredExpression
- type Float
- type Getattr
- type Getitem
- type Inspector
- type Integer
- type List
- type Macro
- type Name
- type Negation
- type Node
- type Output
- type Pair
- type Statement
- type StatementBlock
- type String
- type Template
- type TestCall
- type TestExpression
- type Trim
- type Tuple
- type UnaryExpression
- type Variable
- type VariablePart
- type Visitor
- type Wrapper
Constants ¶
View Source
const ( VarTypeInt = iota VarTypeIdent )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BinOperator ¶
func (BinOperator) Position ¶
func (op BinOperator) Position() *tokens.Token
func (BinOperator) String ¶
func (op BinOperator) String() string
type BinaryExpression ¶
type BinaryExpression struct {
Left Expression
Right Expression
Operator *BinOperator
}
func (*BinaryExpression) Position ¶
func (b *BinaryExpression) Position() *tokens.Token
func (*BinaryExpression) String ¶
func (expr *BinaryExpression) String() string
type BlockSet ¶
func (*BlockSet) Register ¶
Register registers a new block. If there's already a filter with the same name, Register will panic. You usually want to call this function in the filter's init() function: http://golang.org/doc/effective_go.html#init
See http://www.florian-schlachter.de/post/jinjia2/ for more about writing filters and tags.
type Call ¶
type Call struct {
Location *tokens.Token
Func Node
Args []Expression
Kwargs map[string]Expression
}
type Comment ¶
type Comment struct {
Start *tokens.Token // Opening token
Text string // Comment text
End *tokens.Token // Closing token
Trim *Trim
}
A Comment node represents a single {# #} comment.
type Expression ¶
type Expression interface {
Node
}
Expression represents an evaluable expression part
type FilterCall ¶
type FilterCall struct {
Token *tokens.Token
Name string
Args []Expression
Kwargs map[string]Expression
}
type FilteredExpression ¶
type FilteredExpression struct {
Expression Expression
Filters []*FilterCall
}
func (*FilteredExpression) Position ¶
func (expr *FilteredExpression) Position() *tokens.Token
func (*FilteredExpression) String ¶
func (expr *FilteredExpression) String() string
type List ¶
type List struct {
Location *tokens.Token
Val []Expression
}
type Macro ¶
type Negation ¶
type Negation struct {
Term Expression
Operator *tokens.Token
}
type Pair ¶
type Pair struct {
Key Expression
Value Expression
}
type StatementBlock ¶
type StatementBlock struct {
Location *tokens.Token
Name string
Stmt Statement
Trim *Trim
LStrip bool
}
func (StatementBlock) Position ¶
func (s StatementBlock) Position() *tokens.Token
func (StatementBlock) String ¶
func (s StatementBlock) String() string
type Template ¶
type Template struct {
Name string
Nodes []Node
Blocks BlockSet
Macros map[string]*Macro
Parent *Template
}
Template is the root node of any template
type TestCall ¶
type TestCall struct {
Token *tokens.Token
Name string
Args []Expression
Kwargs map[string]Expression
}
type TestExpression ¶
type TestExpression struct {
Expression Expression
Test *TestCall
}
func (*TestExpression) Position ¶
func (expr *TestExpression) Position() *tokens.Token
func (*TestExpression) String ¶
func (expr *TestExpression) String() string
type Tuple ¶
type Tuple struct {
Location *tokens.Token
Val []Expression
}
type UnaryExpression ¶
type UnaryExpression struct {
Negative bool
Term Expression
Operator *tokens.Token
}
func (*UnaryExpression) Position ¶
func (u *UnaryExpression) Position() *tokens.Token
func (*UnaryExpression) String ¶
func (u *UnaryExpression) String() string
type Variable ¶
type Variable struct {
Location *tokens.Token
Parts []*VariablePart
}
type VariablePart ¶
type VariablePart struct {
Type int
S string
I int
IsFunctionCall bool
// callingArgs []functionCallArgument // needed for a function call, represents all argument nodes (Node supports nested function calls)
Args []Expression
Kwargs map[string]Expression
}
func (*VariablePart) String ¶
func (vp *VariablePart) String() string
Click to show internal directories.
Click to hide internal directories.