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

Method ParseTemplate

view/django.go:263–276  ·  view source on GitHub ↗

ParseTemplate adds a custom template from text. This parser does not support funcs per template. Use the `AddFunc` instead.

(name string, contents []byte)

Source from the content-addressed store, hash-verified

261// ParseTemplate adds a custom template from text.
262// This parser does not support funcs per template. Use the `AddFunc` instead.
263func (s *DjangoEngine) ParseTemplate(name string, contents []byte) error {
264 s.rmu.Lock()
265 defer s.rmu.Unlock()
266
267 s.initSet()
268
269 name = strings.TrimPrefix(name, "/")
270 tmpl, err := s.Set.FromBytes(contents)
271 if err == nil {
272 s.templateCache[name] = tmpl
273 }
274
275 return err
276}
277
278func (s *DjangoEngine) initSet() { // protected by the caller.
279 if s.Set == nil {

Callers 1

LoadMethod · 0.95

Calls 1

initSetMethod · 0.95

Tested by

no test coverage detected