MCPcopy
hub / github.com/flosch/pongo2 / NewLocalFileSystemLoader

Function NewLocalFileSystemLoader

template_loader.go:57–65  ·  view source on GitHub ↗

NewLocalFileSystemLoader creates a new LocalFilesystemLoader and allows templatesto be loaded from disk (unrestricted). If any base directory is given (or being set using SetBaseDir), this base directory is being used for path calculation in template inclusions/imports. Otherwise the path is calcula

(baseDir string)

Source from the content-addressed store, hash-verified

55// for path calculation in template inclusions/imports. Otherwise the path
56// is calculated based relatively to the including template's path.
57func NewLocalFileSystemLoader(baseDir string) (*LocalFilesystemLoader, error) {
58 fs := &LocalFilesystemLoader{}
59 if baseDir != "" {
60 if err := fs.SetBaseDir(baseDir); err != nil {
61 return nil, err
62 }
63 }
64 return fs, nil
65}
66
67// SetBaseDir sets the template's base directory. This directory will
68// be used for any relative path in filters, tags and From*-functions to determine

Callers 1

Calls 1

SetBaseDirMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…