1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +00:00

Add an example for httprouter_test, gofmt everything and misspel fixes.

Former-commit-id: e69ffdf9bba4c7e8c3df45c015b3363cc3fc59b6
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-17 10:45:47 +02:00
parent 2eae027e77
commit 9a3c4f4c0a
13 changed files with 307 additions and 19 deletions

View File

@@ -74,7 +74,7 @@ func (h *Adaptor) Adapt(frame *iris.Policies) {
// no need to panic here because we will use the html as the default template engine
// even if the user doesn't asks for
// or no? we had the defaults before... maybe better to give the user
// the oportunity to learn about the template's configuration
// the opportunity to learn about the template's configuration
// (now 6.1.4 ) they are defaulted and users may don't know how and if they can change the configuration
// even if the book and examples covers these things, many times they're asking me on chat.............
// so no defaults? ok no defaults. This file then will be saved to /adaptors as with other template engines.
@@ -94,7 +94,7 @@ func (h *Adaptor) Adapt(frame *iris.Policies) {
// adaptor. We also know that it is not a good idea to have two
// policies with the same function or we can? wait. No we can't.
// We can't because:
// - the RenderPolicy should accept any type of render process, not only tempaltes.
// - the RenderPolicy should accept any type of render process, not only templates.
// - I didn't design iris/policy.go to keep logic about implementation, this would make that very limited
// and I don't want to break that just for the templates.
// - We want community to be able to create packages which can adapt template functions but
@@ -105,13 +105,13 @@ func (h *Adaptor) Adapt(frame *iris.Policies) {
//
// So when the community wants to create a template adaptor has two options:
// - Use the RenderPolicy which is just a func
// - Use the kataras/iris/adaptors/view.Adaptor adaptor wrapper for RenderPolicy with a compination of kataras/go-template/.Engine
// - Use the kataras/iris/adaptors/view.Adaptor adaptor wrapper for RenderPolicy with a combination of kataras/go-template/.Engine
//
//
// So here is the only place we adapt the iris.TemplateFuncsPolicy to the tempaltes, if and only if templates are used,
// So here is the only place we adapt the iris.TemplateFuncsPolicy to the templates, if and only if templates are used,
// otherwise they are just ignored without any creepy things.
//
// The TemplateFuncsPolicy will work in compination with the specific template adaptor's functions(see html.go and the rest)
// The TemplateFuncsPolicy will work in combination with the specific template adaptor's functions(see html.go and the rest)
if len(frame.TemplateFuncsPolicy) > 0 {
mux.SetFuncMapToEngine(frame.TemplateFuncsPolicy, h.engine)

View File

@@ -32,7 +32,7 @@ func Handlebars(directory string, extension string) *HandlebarsAdaptor {
// and optionally {{partial/partial_r/render}} to render other template files like headers and footers
//
// The 'tmplLayoutFile' is a relative path of the templates base directory,
// for the template file whith its extension.
// for the template file with its extension.
//
// Example: Handlebars("./templates", ".html").Layout("layouts/mainLayout.html")
// // mainLayout.html is inside: "./templates/layouts/".

View File

@@ -46,7 +46,7 @@ func (h *HTMLAdaptor) Delims(left string, right string) *HTMLAdaptor {
// and optionally {{partial/partial_r/render}} to render other template files like headers and footers
//
// The 'tmplLayoutFile' is a relative path of the templates base directory,
// for the template file whith its extension.
// for the template file with its extension.
//
// Example: HTML("./templates", ".html").Layout("layouts/mainLayout.html")
// // mainLayout.html is inside: "./templates/layouts/".