ParseTemplate adds a custom template from text. This parser does not support funcs per template. Use the `AddFunc` instead.
(name string, contents []byte)
| 261 | // ParseTemplate adds a custom template from text. |
| 262 | // This parser does not support funcs per template. Use the `AddFunc` instead. |
| 263 | func (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 | |
| 278 | func (s *DjangoEngine) initSet() { // protected by the caller. |
| 279 | if s.Set == nil { |