MCPcopy Create free account
hub / github.com/kataras/iris / HTML

Function HTML

view/html.go:68–90  ·  view source on GitHub ↗

HTML creates and returns a new html view engine. The html engine used like the "html/template" standard go package but with a lot of extra features. The given "extension" MUST begin with a dot. Usage: HTML("./views", ".html") or HTML(iris.Dir("./views"), ".html") or HTML(embed.FS, ".html") or HTML(

(dirOrFS interface{}, extension string)

Source from the content-addressed store, hash-verified

66// HTML(embed.FS, ".html") or HTML(AssetFile(), ".html") for embedded data or
67// HTML("","").ParseTemplate("hello", `[]byte("hello {{.Name}}")`, nil) for custom template parsing only.
68func HTML(dirOrFS interface{}, extension string) *HTMLEngine {
69 s := &HTMLEngine{
70 name: "HTML",
71 fs: getFS(dirOrFS),
72 rootDir: "/",
73 extension: extension,
74 reload: false,
75 left: "{{",
76 right: "}}",
77 layout: "",
78 layoutFuncs: template.FuncMap{
79 "yield": func(binding interface{}) template.HTML {
80 return template.HTML("")
81 },
82 },
83 funcs: make(template.FuncMap),
84 bufPool: &sync.Pool{New: func() interface{} {
85 return new(bytes.Buffer)
86 }},
87 }
88
89 return s
90}
91
92// RootDir sets the directory to be used as a starting point
93// to load templates from the provided file system.

Callers 3

BuildMethod · 0.85
AceFunction · 0.85
PugFunction · 0.85

Calls 2

getFSFunction · 0.85
HTMLMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…