mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 09:57:01 +00:00
:)
This commit is contained in:
@@ -39,7 +39,7 @@ func Ace(fs interface{}, extension string) *AceEngine {
|
||||
s := &AceEngine{HTMLEngine: HTML(fs, extension), indent: ""}
|
||||
s.name = "Ace"
|
||||
|
||||
funcs := make(map[string]interface{}, 0)
|
||||
funcs := make(map[string]interface{})
|
||||
|
||||
once := new(sync.Once)
|
||||
|
||||
|
||||
@@ -143,6 +143,10 @@ func (s *AmberEngine) AddFunc(funcName string, funcBody interface{}) {
|
||||
// Returns an error if something bad happens, user is responsible to catch it.
|
||||
func (s *AmberEngine) Load() error {
|
||||
return walk(s.fs, s.rootDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if info == nil || info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -213,6 +213,10 @@ func (s *DjangoEngine) RegisterTag(tagName string, fn TagParser) error {
|
||||
// Returns an error if something bad happens, user is responsible to catch it.
|
||||
func (s *DjangoEngine) Load() error {
|
||||
return walk(s.fs, s.rootDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if info == nil || info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -19,9 +19,10 @@ type HandlebarsEngine struct {
|
||||
// files configuration
|
||||
rootDir string
|
||||
extension string
|
||||
assetFn func(name string) ([]byte, error) // for embedded, in combination with directory & extension
|
||||
namesFn func() []string // for embedded, in combination with directory & extension
|
||||
reload bool // if true, each time the ExecuteWriter is called the templates will be reloaded.
|
||||
// Not used anymore.
|
||||
// assetFn func(name string) ([]byte, error) // for embedded, in combination with directory & extension
|
||||
// namesFn func() []string // for embedded, in combination with directory & extension
|
||||
reload bool // if true, each time the ExecuteWriter is called the templates will be reloaded.
|
||||
// parser configuration
|
||||
layout string
|
||||
rmu sync.RWMutex
|
||||
|
||||
@@ -246,6 +246,10 @@ func (s *HTMLEngine) load() error {
|
||||
}
|
||||
|
||||
return walk(s.fs, s.rootDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if info == nil || info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
@@ -357,7 +361,7 @@ func (s *HTMLEngine) layoutFuncsFor(lt *template.Template, name string, binding
|
||||
func (s *HTMLEngine) runtimeFuncsFor(t *template.Template, name string, binding interface{}) {
|
||||
funcs := template.FuncMap{
|
||||
"part": func(partName string) (template.HTML, error) {
|
||||
nameTemp := strings.Replace(name, s.extension, "", -1)
|
||||
nameTemp := strings.ReplaceAll(name, s.extension, "")
|
||||
fullPartName := fmt.Sprintf("%s-%s", nameTemp, partName)
|
||||
result, err := s.executeTemplateBuf(fullPartName, binding)
|
||||
if err != nil {
|
||||
|
||||
@@ -222,6 +222,10 @@ func (l *jetLoader) Exists(name string) (string, bool) {
|
||||
// Load should load the templates from a physical system directory or by an embedded one (assets/go-bindata).
|
||||
func (s *JetEngine) Load() error {
|
||||
return walk(s.fs, s.rootDir, func(path string, info os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if info == nil || info.IsDir() {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user