Documentation ¶
Index ¶
- Constants
- Variables
- func AddTemplate(scope Scope, node Node, tag *tokens.Tag) error
- func AddVar(scope Scope, node Node, tag *tokens.Tag) error
- func AppendToBlock(scope Scope, node *TemplateNode, tag *tokens.Tag) error
- func AssertValidVar(nameToken *tokens.String) error
- func BuildDirective(scope Scope, node Node, tag *tokens.Tag) error
- func BuildFile(cache *FileCache, path string, isRoot bool, parameters *tokens.Parens) (*FileScope, *RootNode, error)
- func BuildSVG(scope Scope, node Node, tag *tokens.Tag) error
- func BuildTag(scope Scope, node Node, tag *tokens.Tag) error
- func BuildTemplate(scope Scope, node Node, tag *tokens.Tag) error
- func EvalBlock(scope Scope, node Node, tag *tokens.Tag) error
- func Export(scope Scope, node Node, tag *tokens.Tag) error
- func FinalizeRoot(node *RootNode, control string, cssUrl string, jsUrl string) (*tree.Root, [][]string, error)
- func For(scope Scope, node Node, tag *tokens.Tag) error
- func ForceNewViewFileScriptRegistration(cache *FileCache)
- func GetActiveURL(ctx context.Context) (*tokens.String, error)
- func GetDefine(k string) *tokens.String
- func HasDefine(k string) bool
- func HasGlobal(k string) bool
- func IfElse(scope Scope, node Node, tag *tokens.Tag) error
- func Import(scope Scope, node Node, tag *tokens.Tag) error
- func IsDeferringTemplateNode(node Node) bool
- func IsDirective(key string) bool
- func IsTopLevel(scope Scope) bool
- func IsUniqueOpTargetName(t string) bool
- func Math(scope Scope, node Node, tag *tokens.Tag) error
- func NewRoot(cache *FileCache, path string, control string, cssUrl string, jsUrl string) (*tree.Root, [][]string, error)
- func NewUniqueOpTargetName() string
- func NewViewFileScript(cache *FileCache, absPath string) (scripts.FileScript, error)
- func Print(scope Scope, node Node, tag *tokens.Tag) error
- func RegisterDefine(k, v string)
- func RegisterURL(path string, url string)
- func ReplaceBlockChildren(scope Scope, node *TemplateNode, tag *tokens.Tag) error
- func Script(scope Scope, node Node, tag *tokens.Tag) error
- func SearchStyle(node Node, scope Scope, tagAttr *tokens.StringDict, key string, ...) (tokens.Token, error)
- func SetActiveURL(url string)
- func SetFile(scope Scope, path string, ctx context.Context)
- func Style(scope Scope, node Node, tag *tokens.Tag) error
- func Switch(scope Scope, node Node, tag *tokens.Tag) error
- func TOC(scope Scope, node Node, tag *tokens.Tag) error
- func UnsetActiveURL()
- type AppendOp
- type BranchScope
- type CachedScope
- type Directive
- type FileCache
- type FileScope
- type MathNode
- type Node
- type NodeData
- func (n *NodeData) AppendChild(child tree.Tag) error
- func (n *NodeData) Context() context.Context
- func (n *NodeData) GetBlockTarget(block *tokens.Tag) string
- func (n *NodeData) Name() string
- func (n *NodeData) Parent() Node
- func (n *NodeData) PopOp(id string) (Operation, error)
- func (n *NodeData) SearchStyle(scope tokens.Scope, key *tokens.String, ctx context.Context) (tokens.Token, error)
- func (n *NodeData) SetBlockTarget(block *tokens.Tag, target string)
- func (n *NodeData) Type() NodeType
- type NodeType
- type Operation
- type OperationData
- type PStyle
- func (t *PStyle) Context() context.Context
- func (t *PStyle) Dump(indent string) string
- func (t *PStyle) Eval(scope tokens.Scope) (tokens.Token, error)
- func (t *PStyle) EvalLazy(tag tokens.FinalTag) (tokens.Token, error)
- func (t *PStyle) Get(scope tokens.Scope, idx_ tokens.Token, ctx context.Context) (tokens.Token, error)
- func (t *PStyle) IsSame(other_ tokens.Token) bool
- type ReplaceChildrenOp
- type RootNode
- func (n *RootNode) GetBlockTarget(block *tokens.Tag) string
- func (n *RootNode) PopOp(id string) (Operation, error)
- func (n *RootNode) SearchStyle(scope tokens.Scope, key *tokens.String, ctx context.Context) (tokens.Token, error)
- func (n *RootNode) SetBlockTarget(block *tokens.Tag, target string)
- func (n *RootNode) Type() NodeType
- type SVGNode
- type Scope
- type ScopeData
- func (scope *ScopeData) Eval(key string, args *tokens.Parens, ctx context.Context) (tokens.Token, error)
- func (scope *ScopeData) GetCache() *FileCache
- func (scope *ScopeData) GetTemplate(key string) Template
- func (scope *ScopeData) GetVar(key string) functions.Var
- func (scope *ScopeData) HasTemplate(key string) bool
- func (scope *ScopeData) HasVar(key string) bool
- func (scope *ScopeData) Parent() Scope
- func (s *ScopeData) Permissive() bool
- func (scope *ScopeData) SetTemplate(key string, d Template) error
- func (scope *ScopeData) SetVar(key string, v functions.Var) error
- func (scope *ScopeData) Sync(dst Scope, keepAutoVars, keepImports, asImports bool, prefix string) error
- func (scope *ScopeData) SyncFiltered(dst Scope, keepAutoVars, keepImports, asImports bool, prefix string, ...) error
- func (scope *ScopeData) SyncPackage(dst Scope, keepAutoVars, keepImports, asImports bool, prefix string) error
- type Template
- type TemplateNode
- func (n *TemplateNode) AppendChild(child tree.Tag) error
- func (n *TemplateNode) AppendToDefault(scope Scope, tag *tokens.Tag) error
- func (n *TemplateNode) AssertAllOperationsDone(ctx context.Context) error
- func (n *TemplateNode) GetBlockTarget(block *tokens.Tag) string
- func (n *TemplateNode) Name() string
- func (n *TemplateNode) Parent() Node
- func (n *TemplateNode) PopOp(target string) (Operation, error)
- func (n *TemplateNode) PushOp(op Operation) error
- func (n *TemplateNode) SearchStyle(scope tokens.Scope, key *tokens.String, ctx context.Context) (tokens.Token, error)
- func (n *TemplateNode) SetBlockTarget(block *tokens.Tag, target string)
- func (n *TemplateNode) StartDeferral()
- func (n *TemplateNode) StopDeferral()
- func (n *TemplateNode) Type() NodeType
- type URINode
- type ViewArray
- type ViewBool
- type ViewColor
- type ViewFileScript
- func (s *ViewFileScript) Dependencies() []files.PathLang
- func (s *ViewFileScript) EvalTypes() error
- func (s *ViewFileScript) Module() js.Module
- func (s *ViewFileScript) Path() string
- func (s *ViewFileScript) ResolveActivity(usage js.Usage) error
- func (s *ViewFileScript) ResolveNames(scope js.GlobalScope) error
- func (s *ViewFileScript) UniqueEntryPointNames(ns js.Namespace) error
- func (s *ViewFileScript) UniqueNames(ns js.Namespace) error
- func (s *ViewFileScript) UniversalNames(ns js.Namespace) error
- func (s *ViewFileScript) Walk(fn func(p string, obj interface{}) error) error
- func (s *ViewFileScript) Write() (string, error)
- type ViewInt
- type ViewModule
- type ViewNull
- type ViewNumber
- type ViewObject
- type ViewString
- type ViewVariable
- type ViewVariableData
- func (v *ViewVariableData) Constant() bool
- func (v *ViewVariableData) Context() context.Context
- func (v *ViewVariableData) GetObject() interface{}
- func (v *ViewVariableData) Name() string
- func (v *ViewVariableData) Rename(newName string)
- func (v *ViewVariableData) SetConstant()
- func (v *ViewVariableData) SetObject(interface{})
- func (v *ViewVariableData) SetValue(_ values.Value)
Constants ¶
const ELEMENT_COUNT = "__idx__"
actually not globals, as they are only available inside the template scope
const ELEMENT_COUNT_FOLDED = "__idxf__"
const FILE = "__file__"
const NCHILDREN = "__nchildren__"
const NSIBLINGS = "__nsiblings__"
const PARENT_STYLE = "__pstyle__"
const URL = "__url__"
Variables ¶
var ( NO_ALIASING = false VERBOSITY = 0 )
var IGNORE_UNSET_URLS = false
Functions ¶
func AddTemplate ¶
doesnt change the node
func AppendToBlock ¶
func AppendToBlock(scope Scope, node *TemplateNode, tag *tokens.Tag) error
func AssertValidVar ¶
func BuildFile ¶
func BuildFile(cache *FileCache, path string, isRoot bool, parameters *tokens.Parens) (*FileScope, *RootNode, error)
also used by NewRoot abs path, so we can use this to cache the import results incoming parameters should be evaluated
func FinalizeRoot ¶
func ForceNewViewFileScriptRegistration ¶
func ForceNewViewFileScriptRegistration(cache *FileCache)
in jspp the directives module isn't automatically included, so we need to force (which includes the above lines actually, so this happens twice)
func IsDeferringTemplateNode ¶
func IsDirective ¶
func IsTopLevel ¶
func IsUniqueOpTargetName ¶
func NewUniqueOpTargetName ¶
func NewUniqueOpTargetName() string
func NewViewFileScript ¶
func NewViewFileScript(cache *FileCache, absPath string) (scripts.FileScript, error)
func RegisterDefine ¶
func RegisterDefine(k, v string)
func RegisterURL ¶
func ReplaceBlockChildren ¶
func ReplaceBlockChildren(scope Scope, node *TemplateNode, tag *tokens.Tag) error
func SearchStyle ¶
func SearchStyle(node Node, scope Scope, tagAttr *tokens.StringDict, key string, ctx context.Context) (tokens.Token, error)
search in incoming attr first, the search in parent styles used by Math and SVG to search for color scope is needed for permissiveness
func SetActiveURL ¶
func SetActiveURL(url string)
func UnsetActiveURL ¶
func UnsetActiveURL()
Types ¶
type AppendOp ¶
type AppendOp struct { OperationData // contains filtered or unexported fields }
func NewAppendToDefaultOp ¶
type BranchScope ¶ added in v0.2.0
type BranchScope struct {
ScopeData
}
BranchScope sends to exports to filescope (regular scopedata gives error)
func (*BranchScope) SetTemplate ¶ added in v0.2.0
func (s *BranchScope) SetTemplate(key string, d Template) error
type CachedScope ¶
type CachedScope struct {
// contains filtered or unexported fields
}
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func NewFileCache ¶
func NewFileCache() *FileCache
type FileScope ¶
type FileScope struct { ScopeData // contains filtered or unexported fields }
func NewFileScope ¶
func (*FileScope) Permissive ¶
type MathNode ¶
type MathNode struct { NodeData // contains filtered or unexported fields }
func NewMathNode ¶
style can be nil
func (*MathNode) BuildMathPath ¶
func (*MathNode) BuildMathText ¶
func (*MathNode) NewSubScope ¶
type Node ¶
type Node interface { Parent() Node Name() string Type() NodeType AppendChild(tree.Tag) error PopOp(id string) (Operation, error) // for application GetBlockTarget(block *tokens.Tag) string // empty if not found SetBlockTarget(block *tokens.Tag, target string) SearchStyle(scope tokens.Scope, key *tokens.String, ctx context.Context) (tokens.Token, error) // contains filtered or unexported methods }
styleTree and elementCount fit the node tree better than the scope tree
type NodeData ¶
type NodeData struct {
// contains filtered or unexported fields
}
func (*NodeData) SearchStyle ¶
func (*NodeData) SetBlockTarget ¶
type OperationData ¶
type OperationData struct {
// contains filtered or unexported fields
}
func (*OperationData) Popped ¶
func (op *OperationData) Popped() bool
func (*OperationData) SetPopped ¶
func (op *OperationData) SetPopped()
func (*OperationData) SetTarget ¶
func (op *OperationData) SetTarget(t string)
func (*OperationData) Target ¶
func (op *OperationData) Target() string
type PStyle ¶
type PStyle struct {
// contains filtered or unexported fields
}
implements tokens.Token interface
type ReplaceChildrenOp ¶
type ReplaceChildrenOp struct { OperationData // contains filtered or unexported fields }
func (*ReplaceChildrenOp) Context ¶
func (op *ReplaceChildrenOp) Context() context.Context
type RootNode ¶
type RootNode struct { NodeData // contains filtered or unexported fields }
func (*RootNode) SearchStyle ¶
func (*RootNode) SetBlockTarget ¶
type Scope ¶
type Scope interface { Parent() Scope Permissive() bool HasVar(key string) bool GetVar(key string) functions.Var SetVar(key string, v functions.Var) error HasTemplate(key string) bool GetTemplate(key string) Template SetTemplate(key string, d Template) error // implements tokens.Scope Eval(key string, args *tokens.Parens, ctx context.Context) (tokens.Token, error) GetCache() *FileCache // contains filtered or unexported methods }
func NewBranchScope ¶ added in v0.2.0
func NewSubScope ¶
type ScopeData ¶
type ScopeData struct {
// contains filtered or unexported fields
}
func (*ScopeData) GetTemplate ¶
func (*ScopeData) HasTemplate ¶
func (*ScopeData) Permissive ¶
func (*ScopeData) SyncFiltered ¶
type TemplateNode ¶
type TemplateNode struct {
// contains filtered or unexported fields
}
func GetTemplateNode ¶
func GetTemplateNode(node Node) *TemplateNode
func NewTemplateNode ¶
func NewTemplateNode(parent Node, ctx context.Context) *TemplateNode
func (*TemplateNode) AppendChild ¶
func (n *TemplateNode) AppendChild(child tree.Tag) error
func (*TemplateNode) AppendToDefault ¶
func (n *TemplateNode) AppendToDefault(scope Scope, tag *tokens.Tag) error
func (*TemplateNode) AssertAllOperationsDone ¶
func (n *TemplateNode) AssertAllOperationsDone(ctx context.Context) error
func (*TemplateNode) GetBlockTarget ¶
func (n *TemplateNode) GetBlockTarget(block *tokens.Tag) string
func (*TemplateNode) Name ¶
func (n *TemplateNode) Name() string
func (*TemplateNode) Parent ¶
func (n *TemplateNode) Parent() Node
func (*TemplateNode) PushOp ¶
func (n *TemplateNode) PushOp(op Operation) error
func (*TemplateNode) SearchStyle ¶
func (*TemplateNode) SetBlockTarget ¶
func (n *TemplateNode) SetBlockTarget(block *tokens.Tag, target string)
func (*TemplateNode) StartDeferral ¶
func (n *TemplateNode) StartDeferral()
func (*TemplateNode) StopDeferral ¶
func (n *TemplateNode) StopDeferral()
func (*TemplateNode) Type ¶
func (n *TemplateNode) Type() NodeType
type ViewArray ¶
type ViewArray struct { ViewVariableData // contains filtered or unexported fields }
type ViewBool ¶
type ViewBool struct { ViewVariableData // contains filtered or unexported fields }
type ViewColor ¶
type ViewColor struct { ViewVariableData // contains filtered or unexported fields }
type ViewFileScript ¶
type ViewFileScript struct {
// contains filtered or unexported fields
}
func (*ViewFileScript) Dependencies ¶
func (s *ViewFileScript) Dependencies() []files.PathLang
func (*ViewFileScript) EvalTypes ¶
func (s *ViewFileScript) EvalTypes() error
func (*ViewFileScript) Module ¶
func (s *ViewFileScript) Module() js.Module
func (*ViewFileScript) Path ¶
func (s *ViewFileScript) Path() string
func (*ViewFileScript) ResolveActivity ¶
func (s *ViewFileScript) ResolveActivity(usage js.Usage) error
func (*ViewFileScript) ResolveNames ¶
func (s *ViewFileScript) ResolveNames(scope js.GlobalScope) error
no need to add to the scope
func (*ViewFileScript) UniqueEntryPointNames ¶
func (s *ViewFileScript) UniqueEntryPointNames(ns js.Namespace) error
func (*ViewFileScript) UniqueNames ¶
func (s *ViewFileScript) UniqueNames(ns js.Namespace) error
func (*ViewFileScript) UniversalNames ¶
func (s *ViewFileScript) UniversalNames(ns js.Namespace) error
func (*ViewFileScript) Walk ¶
func (s *ViewFileScript) Walk(fn func(p string, obj interface{}) error) error
func (*ViewFileScript) Write ¶
func (s *ViewFileScript) Write() (string, error)
type ViewInt ¶
type ViewInt struct { ViewVariableData // contains filtered or unexported fields }
type ViewModule ¶
type ViewModule struct {
// contains filtered or unexported fields
}
use this to import ui variables into script files
func (*ViewModule) Context ¶
func (m *ViewModule) Context() context.Context
func (*ViewModule) GetExportedVariable ¶
func (m *ViewModule) GetExportedVariable(gs js.GlobalScope, name string, ctx context.Context) (js.Variable, error)
type ViewNull ¶
type ViewNull struct {
ViewVariableData
}
used as fallback when js.TARGET != "browser"
type ViewNumber ¶
type ViewNumber struct { ViewVariableData // contains filtered or unexported fields }
func (*ViewNumber) Dump ¶
func (v *ViewNumber) Dump(indent string) string
func (*ViewNumber) GetValue ¶
func (v *ViewNumber) GetValue() values.Value
func (*ViewNumber) Write ¶
func (v *ViewNumber) Write() string
type ViewObject ¶
type ViewObject struct { ViewVariableData // contains filtered or unexported fields }
func (*ViewObject) Dump ¶
func (v *ViewObject) Dump(indent string) string
func (*ViewObject) GetValue ¶
func (v *ViewObject) GetValue() values.Value
func (*ViewObject) Write ¶
func (v *ViewObject) Write() string
type ViewString ¶
type ViewString struct { ViewVariableData // contains filtered or unexported fields }
func (*ViewString) Dump ¶
func (v *ViewString) Dump(indent string) string
func (*ViewString) GetValue ¶
func (v *ViewString) GetValue() values.Value
func (*ViewString) Write ¶
func (v *ViewString) Write() string
type ViewVariable ¶
type ViewVariableData ¶
type ViewVariableData struct {
// contains filtered or unexported fields
}
func (*ViewVariableData) Constant ¶
func (v *ViewVariableData) Constant() bool
func (*ViewVariableData) Context ¶
func (v *ViewVariableData) Context() context.Context
func (*ViewVariableData) GetObject ¶
func (v *ViewVariableData) GetObject() interface{}
func (*ViewVariableData) Name ¶
func (v *ViewVariableData) Name() string
func (*ViewVariableData) Rename ¶
func (v *ViewVariableData) Rename(newName string)
func (*ViewVariableData) SetConstant ¶
func (v *ViewVariableData) SetConstant()
func (*ViewVariableData) SetObject ¶
func (v *ViewVariableData) SetObject(interface{})
func (*ViewVariableData) SetValue ¶
func (v *ViewVariableData) SetValue(_ values.Value)
Source Files ¶
- Block.go
- BranchScope.go
- FileCache.go
- FileScope.go
- For.go
- IfElse.go
- ImportExport.go
- Math.go
- MathNode.go
- Node.go
- Print.go
- Root.go
- RootNode.go
- SVG.go
- SVGNode.go
- Scope.go
- ScopeData.go
- Script.go
- Style.go
- Switch.go
- TOC.go
- Template.go
- TemplateNode.go
- URINode.go
- Var.go
- ViewModule.go
- directives.go
- evalGet.go
- evalIsSymbol.go
- evalNew.go
- evalVar.go
- globals.go
- globals_defines.go
- globals_elementCount.go
- globals_file.go
- globals_nchildren.go
- globals_styleTree.go
- globals_url.go
- operations.go