diff --git a/_examples/README.md b/_examples/README.md index 6c91df0e..638086ab 100644 --- a/_examples/README.md +++ b/_examples/README.md @@ -89,7 +89,7 @@ * [Root and Proxy AccessLog instances](logging/request-logger/accesslog-proxy/main.go) * API Documentation * [Yaag](apidoc/yaag/main.go) - * [Swagger](https://github.com/iris-contrib/swagger/tree/master/example) + * [Swagger](https://github.com/iris-contrib/swagger/tree/master/_examples/basic) * [Testing](testing/httptest/main_test.go) * [Recovery](recover/main.go) * [Profiling](pprof/main.go) diff --git a/_examples/view/template_jet_3/main.go b/_examples/view/template_jet_3/main.go index a54e3bf8..0ff91f68 100644 --- a/_examples/view/template_jet_3/main.go +++ b/_examples/view/template_jet_3/main.go @@ -10,7 +10,6 @@ import ( ) func main() { - tmpl := iris.Jet("./views", ".jet") tmpl.Reload(true) diff --git a/go.mod b/go.mod index 1d1bdc18..0506ca02 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.15 require ( github.com/BurntSushi/toml v0.3.1 - github.com/CloudyKit/jet/v5 v5.1.1 + github.com/CloudyKit/jet/v6 v6.0.2 github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398 github.com/andybalholm/brotli v1.0.1 github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible diff --git a/view/jet.go b/view/jet.go index 7a292f57..365702d7 100644 --- a/view/jet.go +++ b/view/jet.go @@ -12,7 +12,7 @@ import ( "github.com/kataras/iris/v12/context" - "github.com/CloudyKit/jet/v5" + "github.com/CloudyKit/jet/v6" ) const jetEngineName = "jet" @@ -209,14 +209,10 @@ func (l *jetLoader) Open(name string) (io.ReadCloser, error) { return l.fs.Open(name) } -// Exists checks if the template name exists by walking the list of template paths -// returns string with the full path of the template and bool true if the template file was found -func (l *jetLoader) Exists(name string) (string, bool) { - if _, err := l.fs.Open(name); err == nil { - return name, true - } - - return "", false +// Exists checks if the template name exists by walking the list of template paths. +func (l *jetLoader) Exists(name string) bool { + _, err := l.fs.Open(name) + return err == nil } // Load should load the templates from a physical system directory or by an embedded one (assets/go-bindata). @@ -250,22 +246,24 @@ func (s *JetEngine) Load() error { func (s *JetEngine) ParseTemplate(name string, contents string) error { s.initSet() - _, err := s.Set.LoadTemplate(name, contents) + _, err := s.Set.Parse(name, contents) return err } func (s *JetEngine) initSet() { s.mu.Lock() if s.Set == nil { - s.Set = jet.NewHTMLSetLoader(s.loader) - s.Set.Delims(s.left, s.right) + var opts = []jet.Option{ + jet.WithDelims(s.left, s.right), + } if s.developmentMode && !isNoOpFS(s.fs) { // this check is made to avoid jet's fs lookup on noOp fs (nil passed by the developer). // This can be produced when nil fs passed // and only `ParseTemplate` is used. - s.Set.SetDevelopmentMode(true) + opts = append(opts, jet.InDevelopmentMode()) } + s.Set = jet.NewSet(s.loader, opts...) if s.vars != nil { for key, value := range s.vars { s.Set.AddGlobal(key, value)