NewRegistry creates and initializes a new templates registry with some defaults (eg. global "raw" template function for unescaped HTML). Use the Registry.Load* methods to load templates into the registry.
()
| 36 | // |
| 37 | // Use the Registry.Load* methods to load templates into the registry. |
| 38 | func NewRegistry() *Registry { |
| 39 | return &Registry{ |
| 40 | cache: store.New[string, *Renderer](nil), |
| 41 | funcs: template.FuncMap{ |
| 42 | "raw": func(str string) template.HTML { |
| 43 | return template.HTML(str) |
| 44 | }, |
| 45 | }, |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | // Registry defines a templates registry that is safe to be used by multiple goroutines. |
| 50 | // |
searching dependent graphs…