Go CLI that turns the markdown currency of this stack (Redmine notes, Discourse posts, briefing output) into typeset PDFs: two embedded typst templates (report with title page/TOC/headers, dense brief), front-matter (title/subtitle/author/date/classification/template), GFM tables, and bar charts rendered in pure Go (go-chart) from fenced chart data blocks. Engine is a prebuilt typst 0.15.1 container pinned by digest and run --network none; PDF bytes to stdout or -o. Exit codes 0/1/2. All dev in docker (dev.sh/Makefile); unit tests + golden typst fixtures plus a host-side smoke against the real engine container. Generated with Crush Assisted-by: Crush:glm-5.2
37 lines
529 B
Go
37 lines
529 B
Go
package matrix
|
|
|
|
import (
|
|
"math"
|
|
"strconv"
|
|
)
|
|
|
|
func minInt(values ...int) int {
|
|
min := math.MaxInt32
|
|
|
|
for x := 0; x < len(values); x++ {
|
|
if values[x] < min {
|
|
min = values[x]
|
|
}
|
|
}
|
|
return min
|
|
}
|
|
|
|
func maxInt(values ...int) int {
|
|
max := math.MinInt32
|
|
|
|
for x := 0; x < len(values); x++ {
|
|
if values[x] > max {
|
|
max = values[x]
|
|
}
|
|
}
|
|
return max
|
|
}
|
|
|
|
func f64s(v float64) string {
|
|
return strconv.FormatFloat(v, 'f', -1, 64)
|
|
}
|
|
|
|
func roundToEpsilon(value, epsilon float64) float64 {
|
|
return math.Nextafter(value, value)
|
|
}
|