// init loads template files into memory.
init loads template files into memory.
// init loads template files into memory .
func (tr *Renderer) init() error {
	tr.mutex.Lock()
	defer tr.mutex.Unlock()
	err := tr.loader.Init()
	if err != nil {
		return err
	}
	funcs := sprig.FuncMap()
	funcs["ordinal"] = ordinal
	funcs["prettify"] = prettifyName
	funcs["carList"] = carList
	funcs["jsonEncode"] = jsonEncode
	funcs["varSplit"] = varSplit
	funcs["timeFormat"] = timeFormat
	funcs["dateFormat"] = dateFormat
	funcs["timeZone"] = timeZone
	funcs["isBefore"] = isBefore
	funcs["trackInfo"] = trackInfo
	funcs["ReadAccess"] = dummyAccessFunc
	funcs["WriteAccess"] = dummyAccessFunc
	funcs["AdminAccess"] = dummyAccessFunc
	funcs["LoggedIn"] = dummyAccessFunc
	funcs["classColor"] = func(i int) string {
		return ChampionshipClassColors[i%len(ChampionshipClassColors)]
	}
	funcs["carSkinURL"] = carSkinURL
	funcs["dict"] = templateDict
	funcs["asset"] = NewAssetHelper("/", "", "", map[string]string{"cb": BuildTime}).GetURL
	funcs["SessionType"] = func(s string) SessionType { return SessionType(s) }
	funcs["Config"] = func() *Configuration { return config }
	funcs["Version"] = func() string { return BuildTime }
	tr.templates, err = tr.loader.Templates(funcs)
	if err != nil {
		return err
	}
	return nil
}
func ( tr * Renderer ) init ( ) error { tr . mutex . Lock ( ) defer tr . mutex . Unlock ( ) err := tr . loader . Init ( ) if err != nil { return err } funcs := sprig . FuncMap ( ) funcs [ " " ] = ordinal funcs [ " " ] = prettifyName funcs [ " " ] = carList funcs [ " " ] = jsonEncode funcs [ " " ] = varSplit funcs [ " " ] = timeFormat funcs [ " " ] = dateFormat funcs [ " " ] = timeZone funcs [ " " ] = isBefore funcs [ " " ] = trackInfo funcs [ " " ] = dummyAccessFunc funcs [ " " ] = dummyAccessFunc funcs [ " " ] = dummyAccessFunc funcs [ " " ] = dummyAccessFunc funcs [ " " ] = func ( i int ) string { return ChampionshipClassColors [ i % len ( ChampionshipClassColors ) ] } funcs [ " " ] = carSkinURL funcs [ " " ] = templateDict funcs [ " " ] = NewAssetHelper ( " " , " " , " " , map [ string ] string { " " : BuildTime } ) . GetURL funcs [ " " ] = func ( s string ) SessionType { return SessionType ( s ) } funcs [ " " ] = func ( ) * Configuration { return config } funcs [ " " ] = func ( ) string { return BuildTime } tr . templates , err = tr . loader . Templates ( funcs ) if err != nil { return err } return nil }
init loads template files into memory.
init loads template files into memory .