forked from gobuffalo/buffalo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
html.go
33 lines (31 loc) · 1.12 KB
/
html.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package render
// HTML renders the named files using the 'text/html'
// content type and the github.com/gobuffalo/plush
// package for templating. If more than 1 file is provided
// the second file will be considered a "layout" file
// and the first file will be the "content" file which will
// be placed into the "layout" using "<%= yield %>".
func HTML(names ...string) Renderer {
e := New(Options{})
return e.HTML(names...)
}
// HTML renders the named files using the 'text/html'
// content type and the github.com/gobuffalo/plush
// package for templating. If more than 1 file is provided
// the second file will be considered a "layout" file
// and the first file will be the "content" file which will
// be placed into the "layout" using "<%= yield %>". If no
// second file is provided and an `HTMLLayout` is specified
// in the options, then that layout file will be used
// automatically.
func (e *Engine) HTML(names ...string) Renderer {
if e.HTMLLayout != "" && len(names) == 1 {
names = append(names, e.HTMLLayout)
}
hr := templateRenderer{
Engine: e,
contentType: "text/html",
names: names,
}
return hr
}