github.com/cheikhshift/buffalo@v0.9.5/render/html.go (about)

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