This commit is contained in:
Daniel 2024-04-26 22:07:35 +08:00
parent 2f3a79ca6a
commit 032c1e2dc6
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -17,13 +17,15 @@
package util
import (
"math"
"text/template"
"time"
"github.com/88250/go-humanize"
"github.com/Masterminds/sprig/v3"
"github.com/araddon/dateparse"
"github.com/siyuan-note/logging"
"github.com/spf13/cast"
"math"
"text/template"
"time"
)
func BuiltInTemplateFuncs() (ret template.FuncMap) {
@ -37,6 +39,7 @@ func BuiltInTemplateFuncs() (ret template.FuncMap) {
ret["log"] = log
ret["logf"] = logf
ret["parseTime"] = parseTime
ret["FormatFloat"] = FormatFloat
return
}
@ -56,3 +59,7 @@ func parseTime(dateStr string) time.Time {
}
return retTime
}
func FormatFloat(format string, n float64) string {
return humanize.FormatFloat(format, n)
}