MCPcopy Create free account
hub / github.com/unrolled/render / prepareHTMLOptions

Method prepareHTMLOptions

render.go:451–481  ·  view source on GitHub ↗
(htmlOpt []HTMLOptions)

Source from the content-addressed store, hash-verified

449}
450
451func (r *Render) prepareHTMLOptions(htmlOpt []HTMLOptions) HTMLOptions {
452 layout := r.opt.Layout
453 funcs := template.FuncMap{}
454
455 var contentType string
456
457 for _, tmp := range r.opt.Funcs {
458 for k, v := range tmp {
459 funcs[k] = v
460 }
461 }
462
463 if len(htmlOpt) > 0 {
464 opt := htmlOpt[0]
465 if len(opt.Layout) > 0 {
466 layout = opt.Layout
467 }
468
469 for k, v := range opt.Funcs {
470 funcs[k] = v
471 }
472
473 contentType = opt.ContentType
474 }
475
476 return HTMLOptions{
477 Layout: layout,
478 Funcs: funcs,
479 ContentType: contentType,
480 }
481}
482
483// Render is the generic function called by XML, JSON, Data, HTML, and can be called by custom implementations.
484func (r *Render) Render(w io.Writer, e Engine, data interface{}) error {

Callers 1

HTMLMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected