1
0
mirror of https://github.com/thebaer/cdr.git synced 2024-11-15 01:31:01 +00:00
cdr/render.go

27 lines
528 B
Go
Raw Normal View History

//go:generate inline -o templates.go -p cdr templates/parts.tmpl
package cdr
import (
"html/template"
"io"
"io/ioutil"
)
func Render(m *Mixtape, w io.Writer) error {
partsRawTmpl, err := ReadAsset("templates/parts.tmpl", false)
if err != nil {
return err
}
mixtapeRawTmpl, err := ioutil.ReadFile("mixtape.tmpl")
if err != nil {
return err
}
t, err := template.New("mixtape").Parse(string(mixtapeRawTmpl) + string(partsRawTmpl))
if err != nil {
return err
}
t.ExecuteTemplate(w, "mixtape", m)
return nil
}