Documentation
¶
Overview ¶
Package template contains methods that will template go text/templates files that may contain sjs snippets.
Index ¶
- type Context
- type ReadFunc
- type Templator
- func (t *Templator) SetContextData(contextData any, globalComputed goja.Value)
- func (t *Templator) TemplateFile(vm VM, templateFile, outFile string, inputData any) error
- func (t *Templator) TemplateString(vm VM, templatePath string, inputData any) (out string, err error)
- func (t *Templator) TemplateStringInput(vm VM, name string, input string, inputData any) (out string, err error)
- type VM
- type WriteFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Templator ¶
type Templator struct { WriteFunc WriteFunc ReadFunc ReadFunc TmplFuncs map[string]any // contains filtered or unexported fields }
Templator extends the go text/template package to allow for sjs snippets.
func (*Templator) SetContextData ¶ added in v0.4.0
SetContextData allows the setting of global context for templating.
func (*Templator) TemplateFile ¶
TemplateFile will template a file and write the output to outFile.
type VM ¶
type VM interface { Get(name string) goja.Value Set(name string, value any) error Compile(name string, src string, strict bool) (*goja.Program, error) RunProgram(p *goja.Program) (result goja.Value, err error) RunString(script string) (result goja.Value, err error) GetObject(val goja.Value) *goja.Object }
VM represents a virtual machine that can be used to run js.
Click to show internal directories.
Click to hide internal directories.