mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 02:17:05 +00:00
Update jet parser to v4.0.0 as requested at: #1551
Former-commit-id: 1ad89532d11716af7a49fe9aafca59e943d98ebe
This commit is contained in:
@@ -49,6 +49,9 @@ func (dt *doneTODOs) Range() (reflect.Value, reflect.Value, bool) {
|
||||
return reflect.Value{}, reflect.Value{}, true
|
||||
}
|
||||
|
||||
// Note: jet version 4 requires this.
|
||||
func (dt *doneTODOs) ProvidesIndex() bool { return true }
|
||||
|
||||
func (dt *doneTODOs) Render(r *view.JetRuntime) {
|
||||
r.Write([]byte(fmt.Sprintf("custom renderer")))
|
||||
}
|
||||
@@ -73,11 +76,6 @@ func main() {
|
||||
// from middlewares as well, by:
|
||||
// view.AddJetRuntimeVars(ctx, vars)
|
||||
// or tmpl.AddRuntimeVars(ctx, vars)
|
||||
//
|
||||
// The Iris Jet fixes the issue when custom jet.Ranger and custom jet.Renderer are not actually work at all,
|
||||
// hope that this is a temp issue on the jet parser itself and authors will fix it soon
|
||||
// so we can remove the "hacks" we've putted for those to work as expected.
|
||||
|
||||
app := iris.New()
|
||||
tmpl := iris.Jet("./views", ".jet") // <--
|
||||
tmpl.Reload(true) // remove in production.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{{extends "layouts/application.jet"}}
|
||||
{{extends "../layouts/application.jet"}}
|
||||
|
||||
{{block button(label, href="javascript:void(0)")}}
|
||||
<a href="{{ href }}">{{ label }}</a>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{{extends "layouts/application.jet"}}
|
||||
{{extends "../layouts/application.jet"}}
|
||||
|
||||
{{block documentBody()}}
|
||||
<h1>Show TODO</h1>
|
||||
<p>This uses a custom renderer by implementing the jet.Renderer (or view.JetRenderer) interface.
|
||||
<p>This uses a custom renderer by implementing the Renderer interface.
|
||||
<p>
|
||||
{{.}}
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user