// Django creates and returns a new amber view engine.
517834
func Django(directory, extension string) *DjangoEngine {
	s := &DjangoEngine{
		directory:     directory,
		extension:     extension,
		globals:       make(map[string]interface{}, 0),
		filters:       make(map[string]FilterFunction, 0),
		templateCache: make(map[string]*pongo2.Template, 0),
	}

	return s
}
908873
func (r *Router) TemplateGlob(pattern string) {
	r.Lock()
	defer r.Unlock()
	r.views = template.Must(template.ParseGlob(pattern))
}
11724
func (v *view) open() error {

	// Never keep a cache for field views.
	if strings.HasPrefix(v.name, viewBSIGroupPrefix) {
		v.cacheType = CacheTypeNone
	}

	if err := func() error {
		// Ensure the view's path exists.
		v.logger.Debugf("ensure view path exists: %s", v.path)
		if err := os.MkdirAll(v.path, 0777); err != nil {
			return errors.Wrap(err, "creating view directory")
		} else if err := os.MkdirAll(filepath.Join(v.path, "fragments"), 0777); err != nil {
			return errors.Wrap(err, "creating fragments directory")
		}

		v.logger.Debugf("open fragments for index/field/view: %s/%s/%s", v.index, v.field, v.name)
		if err := v.openFragments(); err != nil {
			return errors.Wrap(err, "opening fragments")
		}

		return nil
	}(); err != nil {
		v.close()
		return err
	}

	v.logger.Debugf("successfully opened index/field/view: %s/%s/%s", v.index, v.field, v.name)
	return nil
}
568246
func HTTPRouterEngine() http.Handler {
	r := httprouter.New()

	r.GET("/", httpRouterHelloHandler)

	return r
}
1290078
func (m *DB) View(fn func(*bolt.Tx) error) error {
	return m.db.View(fn)
}
1355112
func NewFacade(ctx facade.Context) (*Facade, error) {
	st := ctx.State()
	m, err := st.Model()
	if err != nil {
		return nil, errors.Trace(err)
	}
	return internalFacade(&backend{stateenvirons.EnvironConfigGetter{State: st, Model: m}}, ctx.Auth(), state.CallContext(st))
}
1147686
func HTML(w io.Writer, status int, name string, binding interface{}, htmlOpt ...render.HTMLOptions) error {
	hMutex.Lock()
	defer hMutex.Unlock()
	return Renderer.HTML(w, status, name, binding, htmlOpt...)
}
243789
func (loader *TemplateLoader) CreateTemplateEngine(templateEngineName string) (TemplateEngine, error) {
	if "" == templateEngineName {
		templateEngineName = GO_TEMPLATE
	}
	factory := templateLoaderMap[templateEngineName]
	if nil == factory {
		fmt.Printf("registered factories %#v\n %s \n", templateLoaderMap, templateEngineName)
		return nil, errors.New("Unknown template engine name - " + templateEngineName + ".")
	}
	templateEngine, err := factory(loader)
	if nil != err {
		return nil, errors.New("Failed to init template engine (" + templateEngineName + "), " + err.Error())
	}

	templateLog.Debug("CreateTemplateEngine: init templates", "name", templateEngineName)
	return templateEngine, nil
}
778834
func (vm *ViewLists) Views() ViewList {
	vm.ro.RLock()
	defer vm.ro.RUnlock()
	return vm.lists
}
718772
func (v *View) RenderHTML(m ...string) template.HTML {
	ma, _ := v.encoder.Write(v.Render(m...))
	return template.HTML(ma)
}
433492
func (g *Gui) View(name string) (*View, error) {
	for _, v := range g.views {
		if v.name == name {
			return v, nil
		}
	}
	return nil, ErrUnknownView
}
935623
func (b *PgsqlBuilder) Model(model interface{}) *ModelQuery {
	return NewModelQuery(model, b.db.FieldMapper, b.db, b)
}
335291
func (dal *DjangoAdminLog) DjangoContentType(db XODB) (*DjangoContentType, error) {
	return DjangoContentTypeByID(db, dal.ContentTypeID.Float64)
}
789761
func NewEngine(cfg *config.Config, t *http.Transport, options ...func(*Engine)) *Engine {
	engine := &Engine{
		config:        cfg,
		stop:          make(chan struct{}),
		targetVersion: "unknown",
		client:        &http.Client{Transport: t},
	}

	for _, opt := range options {
		opt(engine)
	}

	if engine.timeManager == nil {
		engine.timeManager = defaultTimeManager{}
	}

	return engine
}
1337176
func (i Info) Generator() template.HTML {
	return template.HTML(fmt.Sprintf(`<meta name="generator" content="Hugo %s" />`, CurrentVersion.String()))
}
679176
func (v *View) Find(filename string) Engine {
	extension := filepath.Ext(filename)
	// Read-Only no locks needed, at serve/runtime-time the library is not supposed to add new view engines
	for i, n := 0, len(v.engines); i < n; i++ {
		e := v.engines[i]
		if e.Ext() == extension {
			return e
		}
	}
	return nil
}
227707
func NewEngine(c *Config, init func(*Engine)) *Engine {
	eo := &Engine{
		Config:      c,
		ChainRouter: relay.NewChainRouter(nil, nil),
		Template:    assets.NewTemplateDir(&c.TemplatesConfig),
		OnInit:      init,
	}

	eo.stop = makeDuration(c.Killbeat, 20)
	eo.heartbeat = makeDuration(c.Heartbeat, (10 * 60))

	return eo
}