This commit is contained in:
Daniel 2024-12-12 16:41:30 +08:00
parent 2f39c2f1bc
commit 29b5124591
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
5 changed files with 176 additions and 22 deletions

View file

@ -20,6 +20,7 @@ import (
"math"
"text/template"
"time"
"unicode/utf8"
"github.com/88250/go-humanize"
"github.com/Masterminds/sprig/v3"
@ -50,9 +51,14 @@ func BuiltInTemplateFuncs() (ret template.FuncMap) {
ret["FormatFloat"] = FormatFloat
ret["getHPathByID"] = getHPathByID
ret["statBlock"] = StatBlock
ret["runeLen"] = runeLen
return
}
func runeLen(s string) int {
return utf8.RuneCountInString(s)
}
func pow(a, b interface{}) int64 { return int64(math.Pow(cast.ToFloat64(a), cast.ToFloat64(b))) }
func powf(a, b interface{}) float64 { return math.Pow(cast.ToFloat64(a), cast.ToFloat64(b)) }
func log(a, b interface{}) int64 {