Documentation ¶
Index ¶
- func IsUsingDot(tree *parse.Tree) bool
- func PrintsAnything(tree *parse.Tree) bool
- func Simplify(tree *parse.Tree)
- func Transform(some interface{}, data interface{}, funcs map[string]interface{})
- func Unhole(tree *parse.Tree, state *State, funcs map[string]interface{})
- func Unshadow(tree *parse.Tree)
- type State
- func (s *State) Add()
- func (s *State) AddVar(name string, r reflect.Type)
- func (s *State) BrowsePathType(path []string, val reflect.Type) reflect.Type
- func (s *State) Current() map[string]reflect.Type
- func (s *State) Dot() reflect.Type
- func (s *State) Enter()
- func (s *State) FindVar(name string) reflect.Type
- func (s *State) GetVar(name string) reflect.Type
- func (s *State) HasVar(name string) bool
- func (s *State) IsMethodPath(path []string, val reflect.Type) bool
- func (s *State) Leave()
- func (s *State) Len() int
- func (s *State) Level() int
- func (s *State) ReflectPath(path []string, val reflect.Type) reflect.Type
- func (s *State) Root() map[string]reflect.Type
- func (s *State) RootDot() reflect.Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUsingDot ¶
IsUsingDot tells if a template tree consumes a dot value.
func PrintsAnything ¶
PrintsAnything tells if a template tree prints anything.
func Transform ¶
func Transform(some interface{}, data interface{}, funcs map[string]interface{})
Transform fully simplify a template. it accepts *text.Template or *html.Template, it panics if the value type is unexpected.
func Unhole ¶
Unhole process the tree until no more type holes subsist in the tree. a type hole being an interface{} value found inside a property path. Exemple: there is a call such a.b.c.d if b is an interface{} value, there is no way to statically type check the subsequent c.d path, it can only be done at runtime via reflection. This process will solve that problem by identifying such situation and isolate type checkable and type uncheckable parts. so such node {{a.b.c.d}} will become {{browsePropertyPath a.b "c.d"}}. Where browsePropertyPath is a new identifier (func of funcmap). Note1: the case may occur with variable/identifier nodes too, lets imagine {{$z := a}}{{$z.b.c.d}} Note2: this will work only after simplify occured
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State ...
func TransformTree ¶
TransformTree fully simplify a template Tree.
func (*State) BrowsePathType ¶
BrowsePathType ...
func (*State) IsMethodPath ¶
IsMethodPath ...
func (*State) ReflectPath ¶
ReflectPath ...