...

Source file src/github.com/noirbizarre/gonja/gonja.go

Documentation: github.com/noirbizarre/gonja

     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  	FromString = DefaultEnv.FromString
    18  	FromBytes  = DefaultEnv.FromBytes
    19  	FromFile   = DefaultEnv.FromFile
    20  	FromCache  = DefaultEnv.FromCache
    21  
    22  	// Globals for the default set
    23  	Globals = DefaultEnv.Globals
    24  )
    25  
    26  // Must panics, if a Template couldn't successfully parsed. This is how you
    27  // would use it:
    28  //     var baseTemplate = gonja.Must(gonja.FromFile("templates/base.html"))
    29  func Must(tpl *exec.Template, err error) *exec.Template {
    30  	if err != nil {
    31  		panic(err)
    32  	}
    33  	return tpl
    34  }
    35  

View as plain text