1
package gonja
2

3
import (
4
	"github.com/noirbizarre/gonja/config"
5
	"github.com/noirbizarre/gonja/exec"
6
	"github.com/noirbizarre/gonja/loaders"
7
)
8

9
var (
10
	// DefaultLoader is being used by the DefaultSet.
11
	DefaultLoader = loaders.MustNewFileSystemLoader("")
12

13
	// DefaultEnv is an environment created for quick/standalone template rendering.
14
	DefaultEnv = NewEnvironment(config.DefaultConfig, DefaultLoader)
15

16
	// Methods on the default set
17
	//--
18

19
	FromString = DefaultEnv.FromString
20
	FromBytes  = DefaultEnv.FromBytes
21
	FromFile   = DefaultEnv.FromFile
22
	FromCache  = DefaultEnv.FromCache
23

24
	// Globals for the default set
25
	Globals = DefaultEnv.Globals
26
)
27

28
// Must panics, if a Template couldn't successfully parsed. This is how you
29
// would use it:
30
//     var baseTemplate = gonja.Must(gonja.FromFile("templates/base.html"))
31 0
func Must(tpl *exec.Template, err error) *exec.Template {
32 0
	if err != nil {
33 0
		panic(err)
34
	}
35 0
	return tpl
36
}

Read our documentation on viewing source code .

Loading