math-optim/report/gen.go

49 lines
744 B
Go
Raw Normal View History

// Copyright 2022 wanderer <a_mirre at utb dot cz>
// SPDX-License-Identifier: GPL-3.0-or-later
//go:build ignore
// +build ignore
package main
import (
_ "embed"
"log"
"os"
"text/template"
"time"
)
var (
//go:embed report_base.tex
reportBase []byte
//go:embed report.tmpl
tmplReportFile []byte
)
func main() {
fName := "../out/tex/report.tex"
f, err := os.Create(fName)
if err != nil {
log.Fatal(err)
}
defer f.Close()
tmplReport := template.New("report")
tmplReport = template.Must(tmplReport.Parse(string(tmplReportFile)))
err = tmplReport.Execute(f, struct {
ReportBase string
Timestamp time.Time
}{
ReportBase: string(reportBase),
Timestamp: time.Now(),
})
if err != nil {
log.Println(err)
}
}