surtur
052b51f0df
All checks were successful
continuous-integration/drone/push Build is passing
make report include `report_base.tex` file verbatim and save it in `out/tex/report.tex` as a base file of the report. currently, this is done when running `go generate ./report` but there are plans to switch from that to emitting the file during runtime, as is done with all other templates.
49 lines
744 B
Go
49 lines
744 B
Go
// 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)
|
|
}
|
|
}
|