MCPcopy Create free account
hub / github.com/kataras/iris / Load

Method Load

view/jet.go:230–260  ·  view source on GitHub ↗

Load should load the templates from a physical system directory or by an embedded one (assets/go-bindata).

()

Source from the content-addressed store, hash-verified

228
229// Load should load the templates from a physical system directory or by an embedded one (assets/go-bindata).
230func (s *JetEngine) Load() error {
231 rootDirName := getRootDirName(s.fs)
232
233 return walk(s.fs, "", func(path string, info os.FileInfo, err error) error {
234 if err != nil {
235 return err
236 }
237
238 if info == nil || info.IsDir() {
239 return nil
240 }
241
242 if s.extension != "" {
243 if !strings.HasSuffix(path, s.extension) {
244 return nil
245 }
246 }
247
248 if s.rootDir == rootDirName {
249 path = strings.TrimPrefix(path, rootDirName)
250 path = strings.TrimPrefix(path, "/")
251 }
252
253 buf, err := asset(s.fs, path)
254 if err != nil {
255 return fmt.Errorf("%s: %w", path, err)
256 }
257
258 return s.ParseTemplate(path, string(buf))
259 })
260}
261
262// ParseTemplate accepts a name and contnets to parse and cache a template.
263// This parser does not support funcs per template. Use the `AddFunc` instead.

Callers

nothing calls this directly

Calls 6

ParseTemplateMethod · 0.95
getRootDirNameFunction · 0.85
walkFunction · 0.85
ErrorfMethod · 0.80
assetFunction · 0.70
IsDirMethod · 0.45

Tested by

no test coverage detected