Documentation ¶
Index ¶
- type Jinja2
- func (j *Jinja2) Cleanup()
- func (j *Jinja2) Close()
- func (j *Jinja2) FindVariables(template string) (result []string, err error)
- func (j *Jinja2) Load(opts ...Jinja2Opt)
- func (j *Jinja2) RenderDirectory(sourceDir string, targetDir string, excludePatterns []string, ...) error
- func (j *Jinja2) RenderFile(template string, opts ...Jinja2Opt) (string, error)
- func (j *Jinja2) RenderFiles(jobs []*RenderJob, opts ...Jinja2Opt) error
- func (j *Jinja2) RenderString(template string, opts ...Jinja2Opt) (string, error)
- func (j *Jinja2) RenderStrings(jobs []*RenderJob, opts ...Jinja2Opt) error
- func (j *Jinja2) RenderStruct(o interface{}, opts ...Jinja2Opt) (bool, error)
- type Jinja2Error
- type Jinja2Opt
- func WithDebugTrace(debugTrace bool) Jinja2Opt
- func WithExtension(e string) Jinja2Opt
- func WithFilter(name string, code string) Jinja2Opt
- func WithGlobal(k string, v any) Jinja2Opt
- func WithGlobals(globals map[string]any) Jinja2Opt
- func WithLStripBlocks(lstripBlocks bool) Jinja2Opt
- func WithPythonPath(p string) Jinja2Opt
- func WithSearchDir(dir string) Jinja2Opt
- func WithSearchDirs(dirs []string) Jinja2Opt
- func WithStrict(strict bool) Jinja2Opt
- func WithTemplateIgnoreRootDir(dir string) Jinja2Opt
- func WithTraceJsonReceive(f func(map[string]any)) Jinja2Opt
- func WithTraceJsonSend(f func(map[string]any)) Jinja2Opt
- func WithTrimBlocks(trimBlocks bool) Jinja2Opt
- type RenderJob
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Jinja2 ¶
type Jinja2 struct {
// contains filtered or unexported fields
}
func (*Jinja2) FindVariables ¶
func (*Jinja2) RenderDirectory ¶
func (*Jinja2) RenderFile ¶
func (*Jinja2) RenderFiles ¶
func (*Jinja2) RenderString ¶
func (*Jinja2) RenderStrings ¶
type Jinja2Error ¶
type Jinja2Error struct {
// contains filtered or unexported fields
}
func (*Jinja2Error) Error ¶
func (m *Jinja2Error) Error() string
type Jinja2Opt ¶
type Jinja2Opt func(o *jinja2Options)
func WithDebugTrace ¶
func WithExtension ¶
func WithFilter ¶
WithFilter adds a custom filter with `name` to the engine
name: the name of the filter code: the code defines a filter function
By default, name of the defined function should be same as the filter name. You can change this behaviour to set your filter name to 'xxx:yyy' format, then the real filter name is 'xxx' and the function name is 'yyy'.
For example, you can use
WithFilter("add", "def add(x, y): return x + y")
And also, you can use
WithFilter("add:my_add", "def my_add(x, y): return x + y")
func WithGlobal ¶
func WithGlobals ¶
func WithLStripBlocks ¶
func WithPythonPath ¶
func WithSearchDir ¶
func WithSearchDirs ¶
func WithStrict ¶
func WithTraceJsonReceive ¶
func WithTraceJsonSend ¶
func WithTrimBlocks ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.