MCPcopy
hub / github.com/gobyexample-cn/gobyexample / renderIndex

Function renderIndex

tools/generate.go:295–306  ·  view source on GitHub ↗
(examples []*Example)

Source from the content-addressed store, hash-verified

293}
294
295func renderIndex(examples []*Example) {
296 if verbose() {
297 fmt.Println("Rendering index")
298 }
299 indexTmpl := template.New("index")
300 template.Must(indexTmpl.Parse(mustReadFile("templates/footer.tmpl")))
301 template.Must(indexTmpl.Parse(mustReadFile("templates/index.tmpl")))
302 indexF, err := os.Create(siteDir + "/index.html")
303 check(err)
304 defer indexF.Close()
305 check(indexTmpl.Execute(indexF, examples))
306}
307
308func renderExamples(examples []*Example) {
309 if verbose() {

Callers 1

mainFunction · 0.85

Calls 3

verboseFunction · 0.85
mustReadFileFunction · 0.85
checkFunction · 0.70

Tested by

no test coverage detected