MCPcopy
hub / github.com/gin-gonic/gin / LoadHTMLFS

Method LoadHTMLFS

gin.go:300–309  ·  view source on GitHub ↗

LoadHTMLFS loads an http.FileSystem and a slice of patterns and associates the result with HTML renderer.

(fs http.FileSystem, patterns ...string)

Source from the content-addressed store, hash-verified

298// LoadHTMLFS loads an http.FileSystem and a slice of patterns
299// and associates the result with HTML renderer.
300func (engine *Engine) LoadHTMLFS(fs http.FileSystem, patterns ...string) {
301 if IsDebugging() {
302 engine.HTMLRender = render.HTMLDebug{FileSystem: fs, Patterns: patterns, FuncMap: engine.FuncMap, Delims: engine.delims}
303 return
304 }
305
306 templ := template.Must(template.New("").Delims(engine.delims.Left, engine.delims.Right).Funcs(engine.FuncMap).ParseFS(
307 filesystem.FileSystem{FileSystem: fs}, patterns...))
308 engine.SetHTMLTemplate(templ)
309}
310
311// SetHTMLTemplate associate a template with HTML renderer.
312func (engine *Engine) SetHTMLTemplate(templ *template.Template) {

Callers 6

TestLoadHTMLFSTestModeFunction · 0.80
TestLoadHTMLFSDebugModeFunction · 0.80
TestLoadHTMLFSUsingTLSFunction · 0.80
TestLoadHTMLFSFuncMapFunction · 0.80
LoadHTMLFSFunction · 0.80

Calls 3

SetHTMLTemplateMethod · 0.95
IsDebuggingFunction · 0.85
DelimsMethod · 0.80

Tested by 5

TestLoadHTMLFSTestModeFunction · 0.64
TestLoadHTMLFSDebugModeFunction · 0.64
TestLoadHTMLFSUsingTLSFunction · 0.64
TestLoadHTMLFSFuncMapFunction · 0.64