mirror of
https://github.com/thebaer/cdr.git
synced 2024-11-15 01:31:01 +00:00
27 lines
528 B
Go
27 lines
528 B
Go
//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
|
|
}
|